@agg-build/hooks 2.4.6 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -84,8 +84,8 @@ __export(src_exports, {
84
84
  MarketStatus: () => MarketStatus,
85
85
  MatchStatus: () => MatchStatus,
86
86
  MatchType: () => MatchType,
87
- QueryClient: () => import_react_query39.QueryClient,
88
- QueryClientProvider: () => import_react_query39.QueryClientProvider,
87
+ QueryClient: () => import_react_query43.QueryClient,
88
+ QueryClientProvider: () => import_react_query43.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: () => import_react_query39.useQueryClient,
187
+ useQueryClient: () => import_react_query43.useQueryClient,
186
188
  useQuoteManaged: () => useQuoteManaged,
187
189
  useRampQuotes: () => useRampQuotes,
188
190
  useRampSession: () => useRampSession,
@@ -200,8 +202,10 @@ __export(src_exports, {
200
202
  useUserHoldings: () => useUserHoldings,
201
203
  useVenueEvent: () => useVenueEvent,
202
204
  useVenueEvents: () => useVenueEvents,
205
+ useVenueKeyStatus: () => useVenueKeyStatus,
203
206
  useVenueMarketMidpoints: () => useVenueMarketMidpoints,
204
207
  useVenueMarkets: () => useVenueMarkets,
208
+ useVenueSellQuotes: () => useVenueSellQuotes,
205
209
  useViewportMidpoints: () => useViewportMidpoints,
206
210
  useVisibleIds: () => useVisibleIds,
207
211
  useWithdrawEstimate: () => useWithdrawEstimate,
@@ -209,7 +213,8 @@ __export(src_exports, {
209
213
  useWithdrawManaged: () => useWithdrawManaged,
210
214
  useWithdrawPreview: () => useWithdrawPreview,
211
215
  useWithdrawalLifecycle: () => useWithdrawalLifecycle,
212
- userActivityQueryKeys: () => userActivityQueryKeys
216
+ userActivityQueryKeys: () => userActivityQueryKeys,
217
+ venueKeyQueryKeys: () => venueKeyQueryKeys
213
218
  });
214
219
  module.exports = __toCommonJS(src_exports);
215
220
 
@@ -347,7 +352,7 @@ var getVenueOrder = (venue) => {
347
352
  var sortVenues = (venues) => [...venues].sort((a, b) => getVenueOrder(a) - getVenueOrder(b));
348
353
 
349
354
  // src/index.ts
350
- var import_react_query39 = require("@tanstack/react-query");
355
+ var import_react_query43 = require("@tanstack/react-query");
351
356
 
352
357
  // src/candle-store.ts
353
358
  var import_sdk = require("@agg-build/sdk");
@@ -809,8 +814,16 @@ var enUsLabels = {
809
814
  categoryTabsAria: "Home page category tabs"
810
815
  },
811
816
  userProfile: {
817
+ tabs: {
818
+ positions: "Positions",
819
+ openOrders: "Open orders",
820
+ activity: "Activity"
821
+ },
812
822
  balance: {
813
823
  availableBalance: "Available Balance",
824
+ reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
825
+ positionsValue: "Positions Value",
826
+ kalshiBalance: "Kalshi Balance",
814
827
  balanceByNetwork: "Balance by network",
815
828
  paperModeNetwork: "Paper",
816
829
  paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
@@ -893,6 +906,25 @@ var enUsLabels = {
893
906
  avgPrefix: "avg",
894
907
  nowPrefix: "now",
895
908
  finalPrefix: "final"
909
+ },
910
+ openOrders: {
911
+ marketHeader: "Market",
912
+ limitPriceHeader: "Limit price",
913
+ filledHeader: "Filled",
914
+ totalHeader: "Total",
915
+ filledShort: "Filled",
916
+ totalShort: "Total",
917
+ expirationHeader: "Expiration",
918
+ goodTilCanceled: "Good 'til canceled",
919
+ expired: "Expired",
920
+ cancel: "Cancel",
921
+ cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
922
+ loading: "Loading open orders",
923
+ loadingMore: "Loading more open orders",
924
+ errorTitle: "Unable to load open orders",
925
+ errorDescription: "Please try again in a moment.",
926
+ emptyTitle: "No open orders",
927
+ emptyDescription: "Your open limit orders will appear here."
896
928
  }
897
929
  },
898
930
  eventList: {
@@ -1126,6 +1158,24 @@ var enUsLabels = {
1126
1158
  noBidsAboveMinPrice: "No venue bids above the minimum price.",
1127
1159
  signInToTrade: "Sign in to trade",
1128
1160
  deposit: "Deposit",
1161
+ addFundsToKalshi: "Add funds to Kalshi",
1162
+ fundKalshiModal: {
1163
+ ariaLabel: "Fund your Kalshi account",
1164
+ title: "Fund Your Kalshi Account",
1165
+ description: "Kalshi manages its own account balances, so funds can't be deposited through agg.market. Add funds directly in Kalshi, then return here to trade with your updated balance.",
1166
+ howItWorks: "How it works",
1167
+ kalshiLinkLabel: "Kalshi",
1168
+ kalshiUrl: "https://kalshi.com",
1169
+ firstStepPrefix: "Go to",
1170
+ firstStepSuffix: "and sign in to your account.",
1171
+ remainingSteps: [
1172
+ "Click Add Funds.",
1173
+ "Complete your deposit using your preferred payment method.",
1174
+ "Return here - your Kalshi balance will be available automatically."
1175
+ ],
1176
+ doItLater: "I'll do it later",
1177
+ done: "Done"
1178
+ },
1129
1179
  kycRequired: "Verify to trade Kalshi",
1130
1180
  kycNotVerifiedTooltip: "You have not been verified yet",
1131
1181
  kycVerify: "Verify Identity",
@@ -1136,8 +1186,35 @@ var enUsLabels = {
1136
1186
  kycSuccessTitle: "Verification successful",
1137
1187
  kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
1138
1188
  kycSuccessDone: "Done",
1189
+ connectKalshi: "Connect to trade Kalshi",
1190
+ tradingAccessVenues: "Venues",
1191
+ tradingAccessAvailable: "Available",
1192
+ tradingAccessAddKalshiAccount: "Add Kalshi Account",
1139
1193
  outcome: (label) => `Outcome: ${label}`,
1140
1194
  smartRouting: "Smart Routing",
1195
+ orderTypeMarket: "Market",
1196
+ orderTypeLimit: "Limit",
1197
+ orderTypeAria: "Order type",
1198
+ limitPrice: "Limit price",
1199
+ limitPriceInputAria: "Limit price in cents",
1200
+ limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
1201
+ limitPriceDecreaseAria: "Decrease limit price",
1202
+ limitPriceIncreaseAria: "Increase limit price",
1203
+ expiration: "Expiration",
1204
+ expirationGoodTilCanceled: "Good 'til canceled",
1205
+ expirationFiveMinutes: "5m",
1206
+ expirationOneHour: "1h",
1207
+ expirationEndOfDay: "End of day (EST)",
1208
+ expirationCustom: "Custom",
1209
+ expirationMenuAria: "Choose expiration",
1210
+ expirationOptions: "Expiration options",
1211
+ expirationDateAria: "Limit order expiration date",
1212
+ expirationStartTime: "Start time",
1213
+ expirationStartTimeHint: "24-hour format",
1214
+ expirationCancel: "Cancel",
1215
+ expirationApply: "Apply",
1216
+ limitOrderPlacedTitle: "Limit order placed",
1217
+ limitOrderPlacedDescription: "Your limit order has been submitted.",
1141
1218
  orderSplitting: "Order Splitting",
1142
1219
  splitOrderDescription: "We split your order for the best price:",
1143
1220
  viewAllRoutes: (count) => `View all (${count})`,
@@ -1304,6 +1381,11 @@ var enUsLabels = {
1304
1381
  cancel: "Cancel",
1305
1382
  verifyConnection: "Verify Connection"
1306
1383
  },
1384
+ success: {
1385
+ title: "Kalshi Account Connected",
1386
+ description: "Your Kalshi account is now connected to AGG. You can start trading Kalshi markets.",
1387
+ done: "Done"
1388
+ },
1307
1389
  fallbackError: "Verification failed. Please check your credentials and try again."
1308
1390
  }
1309
1391
  },
@@ -1353,6 +1435,9 @@ var enUsLabels = {
1353
1435
  moreMarketsTitle: "More markets",
1354
1436
  gameLinesTab: "Game Lines",
1355
1437
  halvesTab: "Halves",
1438
+ quartersTab: "Quarters",
1439
+ setsTab: "Sets",
1440
+ playerPropsTab: "Player Props",
1356
1441
  exactScoreTab: "Exact Score",
1357
1442
  cornersTab: "Corners",
1358
1443
  goalsTab: "Goals",
@@ -1403,6 +1488,12 @@ var enUsLabels = {
1403
1488
  const venue = venueLabel ? ` on ${venueLabel}` : "";
1404
1489
  return `${action}${amount}${price}${venue}`.trim();
1405
1490
  },
1491
+ cancelledTitle: "Order canceled",
1492
+ cancelledMessage: "Your open order was canceled.",
1493
+ cancelPendingTitle: "Cancellation submitted",
1494
+ cancelPendingMessage: "Your cancellation request is being processed.",
1495
+ cancelFailedTitle: "Cancellation failed",
1496
+ cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
1406
1497
  failedTitle: "Order failed",
1407
1498
  failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
1408
1499
  },
@@ -1542,6 +1633,7 @@ var defaultAggUiConfig = {
1542
1633
  enableGradients: false,
1543
1634
  enableVenueEventDiscoveryFilters: false,
1544
1635
  enableNotifications: true,
1636
+ showLimitOrders: false,
1545
1637
  showSportsMarkets: false
1546
1638
  },
1547
1639
  market: {
@@ -1573,7 +1665,7 @@ var mergeAggUiSearchConfig = (config) => {
1573
1665
  };
1574
1666
  };
1575
1667
  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;
1668
+ 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
1669
  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
1670
  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
1671
  const formatters = createFormatters(locale);
@@ -1596,27 +1688,28 @@ var mergeAggUiConfig = (persisted, config) => {
1596
1688
  enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
1597
1689
  enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
1598
1690
  enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications,
1599
- showSportsMarkets: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showSportsMarkets) != null ? _D : defaultAggUiConfig.features.showSportsMarkets
1691
+ showLimitOrders: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showLimitOrders) != null ? _D : defaultAggUiConfig.features.showLimitOrders,
1692
+ showSportsMarkets: (_F = (_E = config == null ? void 0 : config.features) == null ? void 0 : _E.showSportsMarkets) != null ? _F : defaultAggUiConfig.features.showSportsMarkets
1600
1693
  },
1601
1694
  market: {
1602
- arbitrageThreshold: (_F = (_E = config == null ? void 0 : config.market) == null ? void 0 : _E.arbitrageThreshold) != null ? _F : defaultAggUiConfig.market.arbitrageThreshold,
1603
- maxMidpointIdsPerRequest: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.maxMidpointIdsPerRequest) != null ? _H : defaultAggUiConfig.market.maxMidpointIdsPerRequest
1695
+ arbitrageThreshold: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.arbitrageThreshold) != null ? _H : defaultAggUiConfig.market.arbitrageThreshold,
1696
+ maxMidpointIdsPerRequest: (_J = (_I = config == null ? void 0 : config.market) == null ? void 0 : _I.maxMidpointIdsPerRequest) != null ? _J : defaultAggUiConfig.market.maxMidpointIdsPerRequest
1604
1697
  },
1605
1698
  chart: {
1606
- defaultChartTimeRange: (_J = (_I = config == null ? void 0 : config.chart) == null ? void 0 : _I.defaultChartTimeRange) != null ? _J : defaultAggUiConfig.chart.defaultChartTimeRange,
1607
- selectedChartTimeRange: (_N = (_M = (_K = persisted.chart) == null ? void 0 : _K.selectedChartTimeRange) != null ? _M : (_L = config == null ? void 0 : config.chart) == null ? void 0 : _L.defaultChartTimeRange) != null ? _N : defaultAggUiConfig.chart.defaultChartTimeRange,
1699
+ defaultChartTimeRange: (_L = (_K = config == null ? void 0 : config.chart) == null ? void 0 : _K.defaultChartTimeRange) != null ? _L : defaultAggUiConfig.chart.defaultChartTimeRange,
1700
+ 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
1701
  setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
1609
1702
  },
1610
1703
  formatting: {
1611
- formatNumber: (_P = (_O = config == null ? void 0 : config.formatting) == null ? void 0 : _O.formatNumber) != null ? _P : formatters.formatNumber,
1612
- formatPercent: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatPercent) != null ? _R : formatters.formatPercent,
1613
- formatCurrency: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatCurrency) != null ? _T : formatters.formatCurrency,
1614
- formatCompactCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCompactCurrency) != null ? _V : formatters.formatCompactCurrency,
1615
- formatDate: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatDate) != null ? _X : formatters.formatDate
1704
+ formatNumber: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatNumber) != null ? _R : formatters.formatNumber,
1705
+ formatPercent: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatPercent) != null ? _T : formatters.formatPercent,
1706
+ formatCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCurrency) != null ? _V : formatters.formatCurrency,
1707
+ formatCompactCurrency: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatCompactCurrency) != null ? _X : formatters.formatCompactCurrency,
1708
+ formatDate: (_Z = (_Y = config == null ? void 0 : config.formatting) == null ? void 0 : _Y.formatDate) != null ? _Z : formatters.formatDate
1616
1709
  },
1617
1710
  search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
1618
1711
  trading: {
1619
- executionMode: (_Z = (_Y = config == null ? void 0 : config.trading) == null ? void 0 : _Y.executionMode) != null ? _Z : defaultAggUiConfig.trading.executionMode
1712
+ executionMode: (_$ = (__ = config == null ? void 0 : config.trading) == null ? void 0 : __.executionMode) != null ? _$ : defaultAggUiConfig.trading.executionMode
1620
1713
  },
1621
1714
  walletActions: config == null ? void 0 : config.walletActions,
1622
1715
  solanaRpcUrl: config == null ? void 0 : config.solanaRpcUrl
@@ -2004,6 +2097,7 @@ var EMPTY_MANAGED_BALANCES = {
2004
2097
  positions: []
2005
2098
  };
2006
2099
  function AggBalanceProvider({ children }) {
2100
+ var _a;
2007
2101
  const client = (0, import_react3.useContext)(AggClientContext);
2008
2102
  const authContext = (0, import_react3.useContext)(AggAuthContext);
2009
2103
  const {
@@ -2048,39 +2142,81 @@ function AggBalanceProvider({ children }) {
2048
2142
  if (!isUsdBasedToken(token.tokenSymbol)) return sum;
2049
2143
  const tokenAcrossChains = token.chains.reduce(
2050
2144
  (chainSum, chain) => {
2051
- var _a;
2052
- return chainSum + toTokenUnits(chain.balanceRaw, (_a = chain.decimals) != null ? _a : token.decimals);
2145
+ var _a2;
2146
+ return chainSum + toTokenUnits(chain.balanceRaw, (_a2 = chain.decimals) != null ? _a2 : token.decimals);
2053
2147
  },
2054
2148
  0
2055
2149
  );
2056
2150
  return sum + tokenAcrossChains;
2057
2151
  }, 0);
2058
2152
  }, [managedBalances]);
2059
- const balanceBreakdown = (0, import_react3.useMemo)(() => {
2060
- var _a, _b;
2061
- const byChain = /* @__PURE__ */ new Map();
2062
- const cash = managedBalances.cash;
2063
- for (const token of cash) {
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);
2153
+ const availableBalance = (0, import_react3.useMemo)(() => {
2154
+ return managedBalances.cash.reduce((sum, token) => {
2155
+ if (!isUsdBasedToken(token.tokenSymbol)) return sum;
2156
+ if (token.availableRaw != null) {
2157
+ return sum + toTokenUnits(token.availableRaw, token.decimals);
2074
2158
  }
2075
- }
2076
- return Array.from(byChain.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label)).map(([chainId, value2]) => ({
2077
- key: String(chainId),
2078
- label: value2.label,
2079
- balance: value2.balance,
2080
- accountCount: value2.accountCount,
2081
- venues: connectedVenues.length > 0 ? connectedVenues : void 0
2082
- }));
2083
- }, [connectedVenues, managedBalances]);
2159
+ return sum + token.chains.reduce(
2160
+ (chainSum, chain) => {
2161
+ var _a2, _b;
2162
+ return chainSum + toTokenUnits((_a2 = chain.availableRaw) != null ? _a2 : chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
2163
+ },
2164
+ 0
2165
+ );
2166
+ }, 0);
2167
+ }, [managedBalances]);
2168
+ const reservedBalance = (0, import_react3.useMemo)(() => {
2169
+ return managedBalances.cash.reduce((sum, token) => {
2170
+ if (!isUsdBasedToken(token.tokenSymbol)) return sum;
2171
+ if (token.reservedRaw != null) {
2172
+ return sum + toTokenUnits(token.reservedRaw, token.decimals);
2173
+ }
2174
+ return sum + token.chains.reduce(
2175
+ (chainSum, chain) => {
2176
+ var _a2, _b;
2177
+ return chainSum + toTokenUnits((_a2 = chain.heldRaw) != null ? _a2 : "0", (_b = chain.decimals) != null ? _b : token.decimals);
2178
+ },
2179
+ 0
2180
+ );
2181
+ }, 0);
2182
+ }, [managedBalances]);
2183
+ const buildBalanceBreakdown = (0, import_react3.useCallback)(
2184
+ (rawForChain) => {
2185
+ var _a2, _b;
2186
+ const byChain = /* @__PURE__ */ new Map();
2187
+ const cash = managedBalances.cash;
2188
+ for (const token of cash) {
2189
+ if (!isUsdBasedToken(token.tokenSymbol)) continue;
2190
+ for (const chain of token.chains) {
2191
+ const current = (_a2 = byChain.get(chain.chainId)) != null ? _a2 : {
2192
+ label: chainLabelFromId(chain.chainId),
2193
+ balance: 0,
2194
+ accountCount: 0
2195
+ };
2196
+ current.balance += toTokenUnits(rawForChain(chain), (_b = chain.decimals) != null ? _b : token.decimals);
2197
+ current.accountCount += 1;
2198
+ byChain.set(chain.chainId, current);
2199
+ }
2200
+ }
2201
+ return Array.from(byChain.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label)).map(([chainId, value2]) => ({
2202
+ key: String(chainId),
2203
+ label: value2.label,
2204
+ balance: value2.balance,
2205
+ accountCount: value2.accountCount,
2206
+ venues: connectedVenues.length > 0 ? connectedVenues : void 0
2207
+ }));
2208
+ },
2209
+ [connectedVenues, managedBalances.cash]
2210
+ );
2211
+ const balanceBreakdown = (0, import_react3.useMemo)(() => {
2212
+ return buildBalanceBreakdown((chain) => chain.balanceRaw);
2213
+ }, [buildBalanceBreakdown]);
2214
+ const availableBalanceBreakdown = (0, import_react3.useMemo)(() => {
2215
+ return buildBalanceBreakdown((chain) => {
2216
+ var _a2;
2217
+ return (_a2 = chain.availableRaw) != null ? _a2 : chain.balanceRaw;
2218
+ });
2219
+ }, [buildBalanceBreakdown]);
2084
2220
  const positionsBalanceTotal = (0, import_react3.useMemo)(() => {
2085
2221
  const positions = managedBalances.positions;
2086
2222
  return positions.reduce(
@@ -2088,6 +2224,9 @@ function AggBalanceProvider({ children }) {
2088
2224
  0
2089
2225
  );
2090
2226
  }, [managedBalances]);
2227
+ const kalshiVenueCash = (_a = managedBalances.venueCash) == null ? void 0 : _a.find((item) => item.venue === "kalshi");
2228
+ const kalshiBalance = kalshiVenueCash ? kalshiVenueCash.balanceCents / 100 : null;
2229
+ const kalshiPortfolioValue = (kalshiVenueCash == null ? void 0 : kalshiVenueCash.portfolioValueCents) == null ? null : kalshiVenueCash.portfolioValueCents / 100;
2091
2230
  const refetch = (0, import_react3.useCallback)(() => {
2092
2231
  if (!isAuthenticated) return;
2093
2232
  void refetchBalances();
@@ -2101,8 +2240,13 @@ function AggBalanceProvider({ children }) {
2101
2240
  return {
2102
2241
  managedBalances,
2103
2242
  totalBalance: 0,
2243
+ availableBalance: 0,
2244
+ reservedBalance: 0,
2104
2245
  positionsBalanceTotal: 0,
2246
+ kalshiBalance: null,
2247
+ kalshiPortfolioValue: null,
2105
2248
  balanceBreakdown: [],
2249
+ availableBalanceBreakdown: [],
2106
2250
  connectedVenues: [],
2107
2251
  isLoading: false,
2108
2252
  error: null,
@@ -2114,8 +2258,13 @@ function AggBalanceProvider({ children }) {
2114
2258
  return {
2115
2259
  managedBalances,
2116
2260
  totalBalance,
2261
+ availableBalance,
2262
+ reservedBalance,
2117
2263
  positionsBalanceTotal,
2264
+ kalshiBalance,
2265
+ kalshiPortfolioValue,
2118
2266
  balanceBreakdown,
2267
+ availableBalanceBreakdown,
2119
2268
  connectedVenues,
2120
2269
  isLoading: isBalancesLoading,
2121
2270
  error,
@@ -2124,14 +2273,19 @@ function AggBalanceProvider({ children }) {
2124
2273
  };
2125
2274
  }, [
2126
2275
  balanceBreakdown,
2276
+ availableBalance,
2277
+ availableBalanceBreakdown,
2127
2278
  balancesError,
2128
2279
  connectedVenues,
2129
2280
  isBalancesLoading,
2130
2281
  isAuthenticated,
2282
+ kalshiBalance,
2283
+ kalshiPortfolioValue,
2131
2284
  managedBalances,
2132
2285
  positionsBalanceTotal,
2133
2286
  refetch,
2134
2287
  refetchConnectionStatus,
2288
+ reservedBalance,
2135
2289
  totalBalance
2136
2290
  ]);
2137
2291
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AggBalanceContext.Provider, { value, children });
@@ -3995,12 +4149,54 @@ function useExecuteManaged(options) {
3995
4149
  });
3996
4150
  }
3997
4151
 
3998
- // src/execution/use-withdraw-managed.ts
4152
+ // src/execution/use-place-limit-order.ts
3999
4153
  var import_react_query9 = require("@tanstack/react-query");
4000
- function useWithdrawManaged(options) {
4154
+ function usePlaceLimitOrder(options) {
4001
4155
  const client = useAggClient();
4002
4156
  const queryClient = (0, import_react_query9.useQueryClient)();
4003
4157
  return (0, import_react_query9.useMutation)({
4158
+ mutationFn: (params) => client.placeLimitOrder(params),
4159
+ onSuccess: (data) => {
4160
+ var _a;
4161
+ queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
4162
+ queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
4163
+ queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
4164
+ invalidateBalanceQueries(queryClient);
4165
+ (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
4166
+ },
4167
+ onError: options == null ? void 0 : options.onError
4168
+ });
4169
+ }
4170
+
4171
+ // src/execution/use-cancel-managed-order.ts
4172
+ var import_react_query10 = require("@tanstack/react-query");
4173
+ function useCancelManagedOrder(options) {
4174
+ const client = useAggClient();
4175
+ const queryClient = (0, import_react_query10.useQueryClient)();
4176
+ return (0, import_react_query10.useMutation)({
4177
+ mutationFn: (orderId) => client.cancelManagedOrder(orderId),
4178
+ onSuccess: (data, orderId) => {
4179
+ var _a;
4180
+ queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
4181
+ queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
4182
+ invalidatePositionQueries(queryClient);
4183
+ invalidateBalanceQueries(queryClient);
4184
+ invalidateUserActivityQueries(queryClient);
4185
+ (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data, orderId);
4186
+ },
4187
+ onError: (error, orderId) => {
4188
+ var _a;
4189
+ (_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error, orderId);
4190
+ }
4191
+ });
4192
+ }
4193
+
4194
+ // src/execution/use-withdraw-managed.ts
4195
+ var import_react_query11 = require("@tanstack/react-query");
4196
+ function useWithdrawManaged(options) {
4197
+ const client = useAggClient();
4198
+ const queryClient = (0, import_react_query11.useQueryClient)();
4199
+ return (0, import_react_query11.useMutation)({
4004
4200
  mutationFn: (params) => client.withdrawManaged(params),
4005
4201
  onSuccess: (data) => {
4006
4202
  var _a;
@@ -4012,11 +4208,11 @@ function useWithdrawManaged(options) {
4012
4208
  }
4013
4209
 
4014
4210
  // src/execution/use-managed-balances.ts
4015
- var import_react_query10 = require("@tanstack/react-query");
4211
+ var import_react_query12 = require("@tanstack/react-query");
4016
4212
  function useManagedBalances(options) {
4017
4213
  const client = useAggClient();
4018
4214
  const { enabled = true, mode } = options != null ? options : {};
4019
- const query = (0, import_react_query10.useQuery)({
4215
+ const query = (0, import_react_query12.useQuery)({
4020
4216
  queryKey: executionKeys.balances(mode),
4021
4217
  queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
4022
4218
  enabled,
@@ -4030,12 +4226,12 @@ function useManagedBalances(options) {
4030
4226
  }
4031
4227
 
4032
4228
  // src/execution/use-positions.ts
4033
- var import_react_query11 = require("@tanstack/react-query");
4229
+ var import_react_query13 = require("@tanstack/react-query");
4034
4230
  function usePositions(options) {
4035
4231
  var _a, _b, _c, _d;
4036
4232
  const client = useAggClient();
4037
4233
  const { enabled = true, cursor, limit, status, mode } = options != null ? options : {};
4038
- const query = (0, import_react_query11.useQuery)({
4234
+ const query = (0, import_react_query13.useQuery)({
4039
4235
  queryKey: executionKeys.positions(cursor, limit, status, mode),
4040
4236
  queryFn: () => client.getPositions(__spreadValues({ cursor, limit, status }, mode ? { mode } : {})),
4041
4237
  enabled,
@@ -4052,7 +4248,7 @@ function usePositions(options) {
4052
4248
 
4053
4249
  // src/execution/use-deposit-addresses.ts
4054
4250
  var import_react9 = require("react");
4055
- var import_react_query12 = require("@tanstack/react-query");
4251
+ var import_react_query14 = require("@tanstack/react-query");
4056
4252
  var SVM_CHAIN_IDS = /* @__PURE__ */ new Set([792703809]);
4057
4253
  function getDepositAddress(chainId, data) {
4058
4254
  return chainId !== void 0 && SVM_CHAIN_IDS.has(chainId) ? data.svmAddress : data.evmAddress;
@@ -4076,7 +4272,7 @@ function useDepositAddresses(options) {
4076
4272
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4077
4273
  };
4078
4274
  }, [enabled, poll, timeoutMs]);
4079
- const query = (0, import_react_query12.useQuery)({
4275
+ const query = (0, import_react_query14.useQuery)({
4080
4276
  queryKey: executionKeys.depositAddresses(),
4081
4277
  queryFn: () => client.getDepositAddresses(),
4082
4278
  enabled,
@@ -4108,11 +4304,11 @@ function useDepositAddresses(options) {
4108
4304
  }
4109
4305
 
4110
4306
  // src/execution/use-sync-balances.ts
4111
- var import_react_query13 = require("@tanstack/react-query");
4307
+ var import_react_query15 = require("@tanstack/react-query");
4112
4308
  function useSyncBalances(options) {
4113
4309
  const client = useAggClient();
4114
- const queryClient = (0, import_react_query13.useQueryClient)();
4115
- return (0, import_react_query13.useMutation)({
4310
+ const queryClient = (0, import_react_query15.useQueryClient)();
4311
+ return (0, import_react_query15.useMutation)({
4116
4312
  mutationFn: () => client.syncManagedBalances(),
4117
4313
  onSuccess: () => {
4118
4314
  var _a;
@@ -4643,7 +4839,7 @@ var computeClosedPositionTotals = (group) => {
4643
4839
  };
4644
4840
 
4645
4841
  // src/execution/use-redeem.ts
4646
- var import_react_query14 = require("@tanstack/react-query");
4842
+ var import_react_query16 = require("@tanstack/react-query");
4647
4843
  var RedeemRejectedError = class extends Error {
4648
4844
  constructor(message, response) {
4649
4845
  super(message);
@@ -4654,8 +4850,8 @@ var RedeemRejectedError = class extends Error {
4654
4850
  var isLegRejected = (status) => status === "ineligible" || status === "rejected";
4655
4851
  var useRedeem = () => {
4656
4852
  const client = useAggClient();
4657
- const queryClient = (0, import_react_query14.useQueryClient)();
4658
- return (0, import_react_query14.useMutation)({
4853
+ const queryClient = (0, import_react_query16.useQueryClient)();
4854
+ return (0, import_react_query16.useMutation)({
4659
4855
  mutationFn: (body) => __async(null, null, function* () {
4660
4856
  const response = yield client.redeem(body);
4661
4857
  if (response.results.length > 0 && response.results.every((r) => isLegRejected(r.status))) {
@@ -4677,7 +4873,7 @@ var useOnRedeemEvent2 = (listener) => {
4677
4873
  };
4678
4874
 
4679
4875
  // src/execution/use-redeem-eligible-count.ts
4680
- var import_react_query15 = require("@tanstack/react-query");
4876
+ var import_react_query17 = require("@tanstack/react-query");
4681
4877
  var CLAIMABLE_COUNT_PAGE_LIMIT = 100;
4682
4878
  var getClaimablePositionsCount = (client) => __async(null, null, function* () {
4683
4879
  var _a;
@@ -4702,7 +4898,7 @@ var useRedeemEligibleCount = () => {
4702
4898
  var _a;
4703
4899
  const client = useAggClient();
4704
4900
  const { isAuthenticated } = useAggAuthState();
4705
- const query = (0, import_react_query15.useQuery)({
4901
+ const query = (0, import_react_query17.useQuery)({
4706
4902
  queryKey: executionKeys.claimablePositionsCount(),
4707
4903
  queryFn: () => getClaimablePositionsCount(client),
4708
4904
  enabled: isAuthenticated,
@@ -5178,7 +5374,7 @@ function useWithdrawEstimate({
5178
5374
 
5179
5375
  // src/withdraw/use-withdrawal-lifecycle.ts
5180
5376
  var import_react15 = require("react");
5181
- var import_react_query16 = require("@tanstack/react-query");
5377
+ var import_react_query18 = require("@tanstack/react-query");
5182
5378
  var INITIAL_STATE2 = {
5183
5379
  pending: true,
5184
5380
  status: null,
@@ -5235,7 +5431,7 @@ var restToLifecycleState = (response) => {
5235
5431
  function useWithdrawalLifecycle(withdrawalId) {
5236
5432
  const client = useAggClient();
5237
5433
  const wsConnected = useAggWebSocketConnectionState();
5238
- const queryClient = (0, import_react_query16.useQueryClient)();
5434
+ const queryClient = (0, import_react_query18.useQueryClient)();
5239
5435
  const [state, setState] = (0, import_react15.useState)(INITIAL_STATE2);
5240
5436
  const stateRef = (0, import_react15.useRef)(state);
5241
5437
  stateRef.current = state;
@@ -5304,7 +5500,7 @@ function useWithdrawalLifecycle(withdrawalId) {
5304
5500
  }
5305
5501
 
5306
5502
  // src/withdraw/use-withdraw-preview.ts
5307
- var import_react_query17 = require("@tanstack/react-query");
5503
+ var import_react_query19 = require("@tanstack/react-query");
5308
5504
  function useWithdrawPreview({
5309
5505
  amountRaw,
5310
5506
  tokenSymbol,
@@ -5314,7 +5510,7 @@ function useWithdrawPreview({
5314
5510
  }) {
5315
5511
  const client = useAggClient();
5316
5512
  const enabled = !!amountRaw && BigInt(amountRaw || "0") > BigInt(0) && !!tokenSymbol && !!destinationChainId && !!destinationAddress;
5317
- return (0, import_react_query17.useQuery)({
5513
+ return (0, import_react_query19.useQuery)({
5318
5514
  queryKey: [
5319
5515
  "withdraw-preview",
5320
5516
  tokenSymbol,
@@ -5376,13 +5572,30 @@ var getVisibleVenueIdsByConfig = (venueIds, disabledVenues) => {
5376
5572
  var getVenueAvailabilityState = ({
5377
5573
  venueId,
5378
5574
  disabledVenues,
5575
+ isConfigLoading,
5379
5576
  isLocationBlocked
5380
5577
  }) => {
5578
+ if (isConfigLoading) return "hidden";
5381
5579
  if (isVenueDisabledByConfig(venueId, disabledVenues)) return "hidden";
5382
5580
  if (isLocationBlocked) return "geoblocked";
5383
5581
  return "available";
5384
5582
  };
5385
5583
 
5584
+ // src/use-venue-key-status.ts
5585
+ var import_react_query20 = require("@tanstack/react-query");
5586
+ var venueKeyQueryKeys = {
5587
+ all: ["agg", "venue-keys"],
5588
+ status: (venue) => [...venueKeyQueryKeys.all, venue, "status"]
5589
+ };
5590
+ var useVenueKeyStatus = (venue, enabled = true) => {
5591
+ const client = useAggClient();
5592
+ return (0, import_react_query20.useQuery)({
5593
+ queryKey: venueKeyQueryKeys.status(venue),
5594
+ queryFn: () => client.getVenueKeyStatus(venue),
5595
+ enabled
5596
+ });
5597
+ };
5598
+
5386
5599
  // src/use-agg-auth.ts
5387
5600
  var import_react17 = require("react");
5388
5601
  function useAggAuth(options = {}) {
@@ -5451,7 +5664,7 @@ var requestAggAuthChooserOpen = () => {
5451
5664
  };
5452
5665
 
5453
5666
  // src/use-categories.ts
5454
- var import_react_query18 = require("@tanstack/react-query");
5667
+ var import_react_query21 = require("@tanstack/react-query");
5455
5668
  function useCategories(options) {
5456
5669
  var _a, _b, _c, _d, _e, _f;
5457
5670
  const client = useAggClient();
@@ -5459,7 +5672,7 @@ function useCategories(options) {
5459
5672
  const parentId = (_b = options == null ? void 0 : options.parentId) != null ? _b : null;
5460
5673
  const enabled = (_c = options == null ? void 0 : options.enabled) != null ? _c : true;
5461
5674
  const limit = (_d = options == null ? void 0 : options.limit) != null ? _d : 20;
5462
- const query = (0, import_react_query18.useInfiniteQuery)({
5675
+ const query = (0, import_react_query21.useInfiniteQuery)({
5463
5676
  queryKey: [queryKeyScope, "parent", parentId != null ? parentId : "__root__", limit],
5464
5677
  queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
5465
5678
  const res = yield client.getCategories(__spreadValues({
@@ -5491,7 +5704,7 @@ function useCategoryChildren(options) {
5491
5704
  const parentIds = Array.from(
5492
5705
  new Set(((_d = options == null ? void 0 : options.parentIds) != null ? _d : []).filter((parentId) => Boolean(parentId)))
5493
5706
  );
5494
- const queries = (0, import_react_query18.useQueries)({
5707
+ const queries = (0, import_react_query21.useQueries)({
5495
5708
  queries: parentIds.map((parentId) => ({
5496
5709
  queryKey: [queryKeyScope, "parent", parentId, limit],
5497
5710
  queryFn: () => __async(null, null, function* () {
@@ -5534,7 +5747,7 @@ function useDebouncedValue(value, delay) {
5534
5747
  }
5535
5748
 
5536
5749
  // src/use-execution-orders.ts
5537
- var import_react_query19 = require("@tanstack/react-query");
5750
+ var import_react_query22 = require("@tanstack/react-query");
5538
5751
  function useExecutionOrders(options = {}) {
5539
5752
  var _a, _b;
5540
5753
  const client = useAggClient();
@@ -5547,7 +5760,7 @@ function useExecutionOrders(options = {}) {
5547
5760
  enabled = true,
5548
5761
  refetchIntervalMs = false
5549
5762
  } = options;
5550
- const query = (0, import_react_query19.useInfiniteQuery)({
5763
+ const query = (0, import_react_query22.useInfiniteQuery)({
5551
5764
  // quoteId + orderId are part of the cache key — different filters
5552
5765
  // produce different result sets, so they have to vary the key.
5553
5766
  queryKey: [
@@ -5583,7 +5796,7 @@ function useExecutionOrders(options = {}) {
5583
5796
  }
5584
5797
 
5585
5798
  // src/use-user-activity.ts
5586
- var import_react_query20 = require("@tanstack/react-query");
5799
+ var import_react_query23 = require("@tanstack/react-query");
5587
5800
  var DEFAULT_PENDING_REFETCH_INTERVAL_MS = 15e3;
5588
5801
  var PENDING_ACTIVITY_STATUSES = /* @__PURE__ */ new Set([
5589
5802
  "pending",
@@ -5617,7 +5830,7 @@ function useUserActivity(options = {}) {
5617
5830
  enabled = true,
5618
5831
  pendingRefetchIntervalMs = DEFAULT_PENDING_REFETCH_INTERVAL_MS
5619
5832
  } = options;
5620
- const query = (0, import_react_query20.useInfiniteQuery)({
5833
+ const query = (0, import_react_query23.useInfiniteQuery)({
5621
5834
  queryKey: userActivityQueryKeys.feed(type, limit),
5622
5835
  queryFn: ({ pageParam }) => client.getUserActivity({
5623
5836
  type,
@@ -5634,7 +5847,7 @@ function useUserActivity(options = {}) {
5634
5847
  // flight (typically after a deposit / withdraw cache invalidation).
5635
5848
  // Without this the feed flashes to the skeleton mid-session, which
5636
5849
  // is worse UX than briefly showing slightly-stale rows.
5637
- placeholderData: import_react_query20.keepPreviousData,
5850
+ placeholderData: import_react_query23.keepPreviousData,
5638
5851
  refetchInterval: (q) => {
5639
5852
  if (pendingRefetchIntervalMs === false) return false;
5640
5853
  const data = q.state.data;
@@ -5679,12 +5892,12 @@ function useExternalId(options = {}) {
5679
5892
  }
5680
5893
 
5681
5894
  // src/use-execution-positions.ts
5682
- var import_react_query21 = require("@tanstack/react-query");
5895
+ var import_react_query24 = require("@tanstack/react-query");
5683
5896
  function useExecutionPositions(options = {}) {
5684
5897
  var _a, _b;
5685
5898
  const client = useAggClient();
5686
5899
  const { limit = 50, status, mode, enabled = true } = options;
5687
- const query = (0, import_react_query21.useInfiniteQuery)({
5900
+ const query = (0, import_react_query24.useInfiniteQuery)({
5688
5901
  queryKey: executionKeys.positions(null, limit, status != null ? status : null, mode != null ? mode : null),
5689
5902
  queryFn: ({ pageParam }) => client.getExecutionPositions(__spreadProps(__spreadValues({
5690
5903
  limit,
@@ -5715,7 +5928,7 @@ var import_react23 = require("react");
5715
5928
  var import_sdk3 = require("@agg-build/sdk");
5716
5929
 
5717
5930
  // src/use-market-chart.ts
5718
- var import_react_query22 = require("@tanstack/react-query");
5931
+ var import_react_query25 = require("@tanstack/react-query");
5719
5932
 
5720
5933
  // src/market-data/subscription.ts
5721
5934
  var import_react21 = require("react");
@@ -5800,7 +6013,7 @@ function useMarketChart(options) {
5800
6013
  orderbook: true,
5801
6014
  trades: true
5802
6015
  });
5803
- const queries = (0, import_react_query22.useQueries)({
6016
+ const queries = (0, import_react_query25.useQueries)({
5804
6017
  queries: outcomeIds.map((outcomeId) => ({
5805
6018
  // Cache key is intentionally time-free. The rolling window's
5806
6019
  // startTs/endTs advance on every bucket but the user expects the same
@@ -5835,7 +6048,7 @@ function useMarketChart(options) {
5835
6048
  gcTime: 60 * 6e4,
5836
6049
  refetchOnWindowFocus: false,
5837
6050
  retry: 1,
5838
- placeholderData: import_react_query22.keepPreviousData,
6051
+ placeholderData: import_react_query25.keepPreviousData,
5839
6052
  refetchInterval: refetchIntervalMs != null && refetchIntervalMs > 0 ? refetchIntervalMs : false,
5840
6053
  refetchIntervalInBackground: false
5841
6054
  }))
@@ -6078,7 +6291,7 @@ function useEventOrderbookData(venueMarkets, selectedMarketId) {
6078
6291
  }
6079
6292
 
6080
6293
  // src/use-live-market.ts
6081
- var import_react_query23 = require("@tanstack/react-query");
6294
+ var import_react_query26 = require("@tanstack/react-query");
6082
6295
  function outcomeOrderbookToState(response, marketId) {
6083
6296
  var _a, _b, _c, _d;
6084
6297
  const { venue, orderbook, midpoint, spread, seq, checksum, timestamp, venueMarketOutcomeId } = response;
@@ -6128,7 +6341,7 @@ function useLiveMarket(canonicalMarketId) {
6128
6341
  enabled: isLiveSubscriptionEnabled,
6129
6342
  orderbook: true
6130
6343
  });
6131
- const query = (0, import_react_query23.useQuery)({
6344
+ const query = (0, import_react_query26.useQuery)({
6132
6345
  queryKey: marketDataKeys.live(canonicalMarketId != null ? canonicalMarketId : "__disabled__"),
6133
6346
  queryFn: () => __async(null, null, function* () {
6134
6347
  return createMarketLiveState(canonicalMarketId != null ? canonicalMarketId : "__disabled__");
@@ -6140,7 +6353,7 @@ function useLiveMarket(canonicalMarketId) {
6140
6353
  isConnected: Boolean(isLiveSubscriptionEnabled && isConnected)
6141
6354
  })
6142
6355
  });
6143
- const seedQuery = (0, import_react_query23.useQuery)({
6356
+ const seedQuery = (0, import_react_query26.useQuery)({
6144
6357
  queryKey: ["live-market-seed", canonicalMarketId],
6145
6358
  queryFn: ({ signal }) => canonicalMarketId ? client.getOutcomeOrderbook(canonicalMarketId, { signal }) : Promise.resolve(null),
6146
6359
  enabled: Boolean(canonicalMarketId),
@@ -6161,7 +6374,7 @@ function useLiveMarket(canonicalMarketId) {
6161
6374
 
6162
6375
  // src/use-live-outcome-prices.ts
6163
6376
  var import_react26 = require("react");
6164
- var import_react_query24 = require("@tanstack/react-query");
6377
+ var import_react_query27 = require("@tanstack/react-query");
6165
6378
  var EMPTY_PRICES = /* @__PURE__ */ new Map();
6166
6379
  var buildMidpointFingerprint = (outcomeIds, queries) => {
6167
6380
  var _a, _b, _c;
@@ -6187,7 +6400,7 @@ function useLiveOutcomePrices(venueMarkets) {
6187
6400
  }
6188
6401
  return [...ids].sort();
6189
6402
  }, [venueMarkets]);
6190
- const queries = (0, import_react_query24.useQueries)({
6403
+ const queries = (0, import_react_query27.useQueries)({
6191
6404
  queries: outcomeIds.map((id) => ({
6192
6405
  queryKey: marketDataKeys.live(id),
6193
6406
  queryFn: () => createMarketLiveState(id),
@@ -6236,7 +6449,7 @@ function findLivePriceById(livePrices, id) {
6236
6449
 
6237
6450
  // src/use-live-best-prices.ts
6238
6451
  var import_react27 = require("react");
6239
- var import_react_query25 = require("@tanstack/react-query");
6452
+ var import_react_query28 = require("@tanstack/react-query");
6240
6453
  var EMPTY = /* @__PURE__ */ new Map();
6241
6454
  var EMPTY_CANDIDATES = /* @__PURE__ */ new Map();
6242
6455
  var extractOutcomeBestPrices = (state) => {
@@ -6279,7 +6492,7 @@ function useLiveBestPrices(venueMarkets) {
6279
6492
  }
6280
6493
  return [...ids].sort();
6281
6494
  }, [venueMarkets]);
6282
- const queries = (0, import_react_query25.useQueries)({
6495
+ const queries = (0, import_react_query28.useQueries)({
6283
6496
  queries: outcomeIds.map((id) => ({
6284
6497
  queryKey: marketDataKeys.live(id),
6285
6498
  queryFn: () => createMarketLiveState(id),
@@ -6498,7 +6711,7 @@ function useLiveBestPriceCandidates(venueMarkets) {
6498
6711
  }
6499
6712
  return [...ids].sort();
6500
6713
  }, [venueMarkets]);
6501
- const queries = (0, import_react_query25.useQueries)({
6714
+ const queries = (0, import_react_query28.useQueries)({
6502
6715
  queries: outcomeIds.map((id) => ({
6503
6716
  queryKey: marketDataKeys.live(id),
6504
6717
  queryFn: () => createMarketLiveState(id),
@@ -6542,7 +6755,7 @@ function useLiveTrades(canonicalMarketId) {
6542
6755
  }
6543
6756
 
6544
6757
  // src/use-midpoints.ts
6545
- var import_react_query26 = require("@tanstack/react-query");
6758
+ var import_react_query29 = require("@tanstack/react-query");
6546
6759
  var import_react28 = require("react");
6547
6760
  var normalizeVenueMarketIds = (venueMarkets) => {
6548
6761
  var _a;
@@ -6721,7 +6934,7 @@ function useMidpoints(venueMarkets, options) {
6721
6934
  () => resolveBestMidpointCandidateOutcomeIds(venueMarkets),
6722
6935
  [venueMarkets]
6723
6936
  );
6724
- const { data, isLoading } = (0, import_react_query26.useQuery)({
6937
+ const { data, isLoading } = (0, import_react_query29.useQuery)({
6725
6938
  queryKey: ["midpoints", ids, maxMidpointIdsPerRequest],
6726
6939
  queryFn: () => client.getMidpoints(ids, { bestPrice: true, maxMidpointIdsPerRequest }),
6727
6940
  enabled: ids.length > 0,
@@ -6866,10 +7079,10 @@ var useRollingChartWindow = (options) => {
6866
7079
  };
6867
7080
 
6868
7081
  // src/use-market-orderbook.ts
6869
- var import_react_query27 = require("@tanstack/react-query");
7082
+ var import_react_query30 = require("@tanstack/react-query");
6870
7083
  function useMarketOrderbook(options) {
6871
7084
  var _a, _b, _c, _d, _e, _f, _g, _h;
6872
- const queryClient = (0, import_react_query27.useQueryClient)();
7085
+ const queryClient = (0, import_react_query30.useQueryClient)();
6873
7086
  const ws = useAggWebSocket();
6874
7087
  const isConnected = useAggWebSocketConnectionState();
6875
7088
  const {
@@ -6887,7 +7100,7 @@ function useMarketOrderbook(options) {
6887
7100
  enabled: enabled && !!selectedOutcomeId,
6888
7101
  orderbook: true
6889
7102
  });
6890
- const liveQueries = (0, import_react_query27.useQueries)({
7103
+ const liveQueries = (0, import_react_query30.useQueries)({
6891
7104
  queries: subscriptionIds.map((subscriptionId) => ({
6892
7105
  queryKey: marketDataKeys.live(subscriptionId),
6893
7106
  queryFn: () => createMarketLiveState(subscriptionId),
@@ -7011,7 +7224,7 @@ function useArbFeed() {
7011
7224
  }
7012
7225
 
7013
7226
  // src/use-order-book.ts
7014
- var import_react_query28 = require("@tanstack/react-query");
7227
+ var import_react_query31 = require("@tanstack/react-query");
7015
7228
  function useOrderBook(options) {
7016
7229
  const client = useAggClient();
7017
7230
  const { orderbooks, enabled = true, canonicalMarketId } = options;
@@ -7024,7 +7237,7 @@ function useOrderBook(options) {
7024
7237
  venueMarketOutcomeId: outcome.id
7025
7238
  })) : void 0
7026
7239
  });
7027
- const batchedResult = (0, import_react_query28.useQuery)({
7240
+ const batchedResult = (0, import_react_query31.useQuery)({
7028
7241
  queryKey: requestedVenueMarketIds.length ? ["orderbooks", requestedVenueMarketIds, null] : ["orderbooks", "__disabled__", null],
7029
7242
  queryFn: ({ signal }) => client.getOrderbooks(
7030
7243
  {
@@ -7037,7 +7250,7 @@ function useOrderBook(options) {
7037
7250
  gcTime: 5 * 6e4,
7038
7251
  refetchOnWindowFocus: false,
7039
7252
  retry: 1,
7040
- placeholderData: import_react_query28.keepPreviousData
7253
+ placeholderData: import_react_query31.keepPreviousData
7041
7254
  });
7042
7255
  const data = (() => {
7043
7256
  var _a, _b;
@@ -7092,7 +7305,7 @@ function useOrderBook(options) {
7092
7305
  }
7093
7306
 
7094
7307
  // src/use-orderbook-quote.ts
7095
- var import_react_query29 = require("@tanstack/react-query");
7308
+ var import_react_query32 = require("@tanstack/react-query");
7096
7309
  var QUOTE_DEBOUNCE_MS = 300;
7097
7310
  var createUnavailableOrderbookError = (message, code, retryable) => {
7098
7311
  const error = new Error(message);
@@ -7154,7 +7367,7 @@ function useOrderbookQuote(options) {
7154
7367
  const { marketId, side, size, enabled = true } = options;
7155
7368
  const debouncedSize = useDebouncedValue(size, QUOTE_DEBOUNCE_MS);
7156
7369
  const shouldFetch = enabled && !!marketId && debouncedSize > 0;
7157
- const query = (0, import_react_query29.useQuery)({
7370
+ const query = (0, import_react_query32.useQuery)({
7158
7371
  queryKey: marketId ? marketDataKeys.orderbookQuote(marketId, side, debouncedSize) : ["market-data", "orderbook-quote", "__disabled__"],
7159
7372
  queryFn: () => __async(null, null, function* () {
7160
7373
  var _a2, _b, _c, _d;
@@ -7185,7 +7398,7 @@ function useOrderbookQuote(options) {
7185
7398
  staleTime: 1e4,
7186
7399
  gcTime: 5 * 6e4,
7187
7400
  retry: 1,
7188
- placeholderData: import_react_query29.keepPreviousData
7401
+ placeholderData: import_react_query32.keepPreviousData
7189
7402
  });
7190
7403
  return {
7191
7404
  data: (_a = query.data) != null ? _a : null,
@@ -7196,12 +7409,12 @@ function useOrderbookQuote(options) {
7196
7409
  }
7197
7410
 
7198
7411
  // src/use-orders.ts
7199
- var import_react_query30 = require("@tanstack/react-query");
7412
+ var import_react_query33 = require("@tanstack/react-query");
7200
7413
  function useOrders(options = {}) {
7201
7414
  var _a, _b, _c, _d;
7202
7415
  const client = useAggClient();
7203
7416
  const { userId, status, limit = 50, offset = 0, enabled = true } = options;
7204
- const query = (0, import_react_query30.useQuery)({
7417
+ const query = (0, import_react_query33.useQuery)({
7205
7418
  queryKey: ["orders", userId != null ? userId : "me", status != null ? status : "all", limit, offset],
7206
7419
  queryFn: () => client.getOrders({
7207
7420
  userId,
@@ -7218,13 +7431,13 @@ function useOrders(options = {}) {
7218
7431
  }
7219
7432
 
7220
7433
  // src/use-search.ts
7221
- var import_react_query31 = require("@tanstack/react-query");
7434
+ var import_react_query34 = require("@tanstack/react-query");
7222
7435
  var import_react31 = require("react");
7223
7436
  function useSearch(options) {
7224
7437
  var _a, _b, _c, _d;
7225
7438
  const client = (0, import_react31.useContext)(AggClientContext);
7226
- const queryClient = (0, import_react31.useContext)(import_react_query31.QueryClientContext);
7227
- const [fallbackQueryClient] = (0, import_react31.useState)(() => new import_react_query31.QueryClient());
7439
+ const queryClient = (0, import_react31.useContext)(import_react_query34.QueryClientContext);
7440
+ const [fallbackQueryClient] = (0, import_react31.useState)(() => new import_react_query34.QueryClient());
7228
7441
  const { q, type, categoryIds, status, limit = 20, enabled = true, deep = false } = options;
7229
7442
  const isEnabled = enabled && q.length > 0;
7230
7443
  (0, import_react31.useEffect)(() => {
@@ -7237,7 +7450,7 @@ function useSearch(options) {
7237
7450
  if (isEnabled && !client) {
7238
7451
  throw new Error("useSearch must be used within an <AggProvider>");
7239
7452
  }
7240
- const query = (0, import_react_query31.useInfiniteQuery)(
7453
+ const query = (0, import_react_query34.useInfiniteQuery)(
7241
7454
  {
7242
7455
  // deep is part of the key — TanStack treats deep vs light as
7243
7456
  // independent queries so users can have both modes cached side-by-side.
@@ -7271,7 +7484,7 @@ function useSearch(options) {
7271
7484
  if (!lastPage.hasMore) return void 0;
7272
7485
  return (_a2 = lastPage.nextCursor) != null ? _a2 : void 0;
7273
7486
  },
7274
- placeholderData: import_react_query31.keepPreviousData,
7487
+ placeholderData: import_react_query34.keepPreviousData,
7275
7488
  enabled: isEnabled && !!client
7276
7489
  },
7277
7490
  queryClient != null ? queryClient : fallbackQueryClient
@@ -7379,7 +7592,7 @@ function useMarketSearch(options) {
7379
7592
  }
7380
7593
 
7381
7594
  // src/use-smart-route.ts
7382
- var import_react_query32 = require("@tanstack/react-query");
7595
+ var import_react_query35 = require("@tanstack/react-query");
7383
7596
 
7384
7597
  // src/smart-route-refresh-policy.ts
7385
7598
  var THIN_SMART_ROUTE_REFETCH_INTERVAL_MS = 5e3;
@@ -7505,7 +7718,7 @@ var getIsDocumentVisible = () => {
7505
7718
  return document.visibilityState !== "hidden";
7506
7719
  };
7507
7720
  function useSmartRoute(options) {
7508
- var _a, _b;
7721
+ var _a, _b, _c, _d;
7509
7722
  const client = useAggClient();
7510
7723
  const {
7511
7724
  venueMarketOutcomeId,
@@ -7519,6 +7732,7 @@ function useSmartRoute(options) {
7519
7732
  chainBalances,
7520
7733
  slipCapBps,
7521
7734
  compareVenues,
7735
+ sellCacheScope,
7522
7736
  deepEstimate,
7523
7737
  enabled = true,
7524
7738
  staleTimeMs = SMART_ROUTE_STALE_TIME_MS,
@@ -7527,7 +7741,7 @@ function useSmartRoute(options) {
7527
7741
  const resolvedVenueMarketOutcomeId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : venueMarketId) != null ? _a : outcomeId;
7528
7742
  const hasValidInput = (maxSpend != null ? maxSpend : 0) > 0 || (sellShares != null ? sellShares : 0) > 0;
7529
7743
  const queryEnabled = enabled && !!resolvedVenueMarketOutcomeId && hasValidInput;
7530
- const query = (0, import_react_query32.useQuery)({
7744
+ const query = (0, import_react_query35.useQuery)({
7531
7745
  queryKey: [
7532
7746
  "smart-route",
7533
7747
  resolvedVenueMarketOutcomeId,
@@ -7539,7 +7753,8 @@ function useSmartRoute(options) {
7539
7753
  chainBalances ? JSON.stringify(chainBalances) : null,
7540
7754
  slipCapBps != null ? slipCapBps : null,
7541
7755
  compareVenues != null ? compareVenues : false,
7542
- deepEstimate != null ? deepEstimate : false
7756
+ deepEstimate != null ? deepEstimate : false,
7757
+ ...tradeSide === "sell" ? [(_b = sellCacheScope == null ? void 0 : sellCacheScope.accountId) != null ? _b : null, (_c = sellCacheScope == null ? void 0 : sellCacheScope.positionVersion) != null ? _c : null] : []
7543
7758
  ],
7544
7759
  queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
7545
7760
  return client.getSmartRoute(
@@ -7561,7 +7776,7 @@ function useSmartRoute(options) {
7561
7776
  enabled: queryEnabled,
7562
7777
  staleTime: staleTimeMs,
7563
7778
  refetchInterval: (queryState) => {
7564
- var _a2, _b2, _c, _d;
7779
+ var _a2, _b2, _c2, _d2;
7565
7780
  return resolveSmartRouteRefetchInterval({
7566
7781
  data: queryState.state.data,
7567
7782
  defaultIntervalMs: staleTimeMs,
@@ -7569,8 +7784,8 @@ function useSmartRoute(options) {
7569
7784
  isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
7570
7785
  isInputValid: hasValidInput,
7571
7786
  isMarketOpen: (_b2 = refreshContext == null ? void 0 : refreshContext.isMarketOpen) != null ? _b2 : true,
7572
- isPanelActive: (_c = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c : true,
7573
- isSubmitting: (_d = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d : false,
7787
+ isPanelActive: (_c2 = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c2 : true,
7788
+ isSubmitting: (_d2 = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d2 : false,
7574
7789
  queryEnabled
7575
7790
  });
7576
7791
  },
@@ -7578,7 +7793,11 @@ function useSmartRoute(options) {
7578
7793
  refetchOnWindowFocus: false,
7579
7794
  refetchIntervalInBackground: false,
7580
7795
  retry: 1,
7581
- placeholderData: import_react_query32.keepPreviousData
7796
+ // A previous SELL quote can carry a quoteId and position availability for
7797
+ // a different amount or position snapshot. Never expose it under a new
7798
+ // sell key while the replacement request is in flight. BUY retains the
7799
+ // existing no-flicker behavior.
7800
+ placeholderData: tradeSide === "sell" ? void 0 : import_react_query35.keepPreviousData
7582
7801
  });
7583
7802
  const error = query.error;
7584
7803
  let loadingReason = null;
@@ -7590,7 +7809,7 @@ function useSmartRoute(options) {
7590
7809
  }
7591
7810
  }
7592
7811
  return {
7593
- data: (_b = query.data) != null ? _b : null,
7812
+ data: (_d = query.data) != null ? _d : null,
7594
7813
  isLoading: query.isLoading,
7595
7814
  isFetching: query.isFetching,
7596
7815
  error: error instanceof Error ? error : error ? new Error(String(error)) : null,
@@ -7599,13 +7818,124 @@ function useSmartRoute(options) {
7599
7818
  };
7600
7819
  }
7601
7820
 
7821
+ // src/use-venue-sell-quotes.ts
7822
+ var import_react_query36 = require("@tanstack/react-query");
7823
+ var getIsDocumentVisible2 = () => {
7824
+ if (typeof document === "undefined") return true;
7825
+ return document.visibilityState !== "hidden";
7826
+ };
7827
+ var getUniqueVenueRequests = (requests) => {
7828
+ const requestsByVenue = /* @__PURE__ */ new Map();
7829
+ for (const request of requests) {
7830
+ if (request.requestedSellShares <= 0 || request.sellShares <= 0 || request.availableShares <= 0) {
7831
+ continue;
7832
+ }
7833
+ if (requestsByVenue.has(request.venue)) continue;
7834
+ requestsByVenue.set(request.venue, request);
7835
+ }
7836
+ return [...requestsByVenue.values()].sort((left, right) => left.venue.localeCompare(right.venue));
7837
+ };
7838
+ var useVenueSellQuotes = (options) => {
7839
+ var _a, _b;
7840
+ const client = useAggClient();
7841
+ const {
7842
+ venueMarketOutcomeId,
7843
+ accountId,
7844
+ positionVersion,
7845
+ requests,
7846
+ mode,
7847
+ slipCapBps,
7848
+ enabled = true,
7849
+ staleTimeMs = SMART_ROUTE_STALE_TIME_MS,
7850
+ refreshContext
7851
+ } = options;
7852
+ const uniqueRequests = getUniqueVenueRequests(requests);
7853
+ const queries = (0, import_react_query36.useQueries)({
7854
+ queries: uniqueRequests.map((request) => {
7855
+ const hasValidInput = request.requestedSellShares > 0 && request.sellShares > 0 && request.availableShares > 0;
7856
+ const queryEnabled = enabled && !!venueMarketOutcomeId && !!accountId && hasValidInput;
7857
+ return {
7858
+ queryKey: [
7859
+ "smart-route",
7860
+ venueMarketOutcomeId,
7861
+ "venue-sell",
7862
+ {
7863
+ accountId: accountId != null ? accountId : null,
7864
+ positionVersion: positionVersion != null ? positionVersion : null,
7865
+ requestedSellShares: request.requestedSellShares,
7866
+ sellShares: request.sellShares,
7867
+ availableShares: request.availableShares,
7868
+ allowedVenues: [request.venue],
7869
+ compareVenues: false,
7870
+ tradeSide: "sell",
7871
+ mode: mode != null ? mode : null,
7872
+ slipCapBps: slipCapBps != null ? slipCapBps : null
7873
+ }
7874
+ ],
7875
+ queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
7876
+ return client.getSmartRoute(
7877
+ __spreadProps(__spreadValues({
7878
+ venueMarketOutcomeId,
7879
+ tradeSide: "sell"
7880
+ }, mode ? { mode } : {}), {
7881
+ sellShares: request.sellShares,
7882
+ slipCapBps,
7883
+ allowedVenues: [request.venue]
7884
+ }),
7885
+ { signal }
7886
+ );
7887
+ }),
7888
+ enabled: queryEnabled,
7889
+ staleTime: staleTimeMs,
7890
+ refetchInterval: (queryState) => {
7891
+ var _a2, _b2, _c, _d;
7892
+ return resolveSmartRouteRefetchInterval({
7893
+ data: queryState.state.data,
7894
+ defaultIntervalMs: staleTimeMs,
7895
+ isDocumentVisible: getIsDocumentVisible2(),
7896
+ isEditing: (_a2 = refreshContext == null ? void 0 : refreshContext.isEditing) != null ? _a2 : false,
7897
+ isInputValid: hasValidInput,
7898
+ isMarketOpen: (_b2 = refreshContext == null ? void 0 : refreshContext.isMarketOpen) != null ? _b2 : true,
7899
+ isPanelActive: (_c = refreshContext == null ? void 0 : refreshContext.isPanelActive) != null ? _c : true,
7900
+ isSubmitting: (_d = refreshContext == null ? void 0 : refreshContext.isSubmitting) != null ? _d : false,
7901
+ queryEnabled
7902
+ });
7903
+ },
7904
+ gcTime: 6e4,
7905
+ refetchOnWindowFocus: false,
7906
+ refetchIntervalInBackground: false,
7907
+ retry: 1
7908
+ };
7909
+ })
7910
+ });
7911
+ const quotes = queries.map((query, index) => {
7912
+ var _a2;
7913
+ const queryError = query.error;
7914
+ return {
7915
+ request: uniqueRequests[index],
7916
+ data: (_a2 = query.data) != null ? _a2 : null,
7917
+ isLoading: query.isLoading,
7918
+ isFetching: query.isFetching,
7919
+ error: queryError instanceof Error ? queryError : queryError ? new Error(String(queryError)) : null,
7920
+ refetch: query.refetch
7921
+ };
7922
+ });
7923
+ return {
7924
+ quotes,
7925
+ isLoading: quotes.some((quote) => quote.isLoading),
7926
+ isFetching: quotes.some((quote) => quote.isFetching),
7927
+ error: (_b = (_a = quotes.find((quote) => quote.error)) == null ? void 0 : _a.error) != null ? _b : null,
7928
+ refetch: () => Promise.all(quotes.map((quote) => quote.refetch()))
7929
+ };
7930
+ };
7931
+
7602
7932
  // src/use-user-holdings.ts
7603
- var import_react_query33 = require("@tanstack/react-query");
7933
+ var import_react_query37 = require("@tanstack/react-query");
7604
7934
  function useUserHoldings(options) {
7605
7935
  var _a, _b;
7606
7936
  const client = useAggClient();
7607
7937
  const { venue, venueMarketId, venueEventId, enabled = true } = options;
7608
- const query = (0, import_react_query33.useInfiniteQuery)({
7938
+ const query = (0, import_react_query37.useInfiniteQuery)({
7609
7939
  queryKey: ["user-holdings", venue, venueMarketId, venueEventId],
7610
7940
  queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
7611
7941
  return client.getUserHoldings({
@@ -7634,7 +7964,7 @@ function useUserHoldings(options) {
7634
7964
  var import_react34 = require("react");
7635
7965
 
7636
7966
  // src/use-venue-event.ts
7637
- var import_react_query34 = require("@tanstack/react-query");
7967
+ var import_react_query38 = require("@tanstack/react-query");
7638
7968
  var RESOLUTION_POLL_MS = 15e3;
7639
7969
  var RESOLUTION_POLL_MAX_PAST_END_MS = 60 * 6e4;
7640
7970
  function resolutionPollInterval(event) {
@@ -7652,7 +7982,7 @@ function useVenueEvent(options) {
7652
7982
  var _a;
7653
7983
  const client = useAggClient();
7654
7984
  const { eventId, enabled = true } = options;
7655
- const query = (0, import_react_query34.useQuery)({
7985
+ const query = (0, import_react_query38.useQuery)({
7656
7986
  queryKey: ["venue-event", eventId],
7657
7987
  queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
7658
7988
  return client.getVenueEventById(eventId, { signal });
@@ -7672,13 +8002,13 @@ function useVenueEvent(options) {
7672
8002
  }
7673
8003
 
7674
8004
  // src/use-venue-markets.ts
7675
- var import_react_query35 = require("@tanstack/react-query");
8005
+ var import_react_query39 = require("@tanstack/react-query");
7676
8006
  var import_react33 = require("react");
7677
8007
  function useVenueMarkets(options) {
7678
8008
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7679
8009
  const client = (0, import_react33.useContext)(AggClientContext);
7680
- const queryClient = (0, import_react33.useContext)(import_react_query35.QueryClientContext);
7681
- const [fallbackQueryClient] = (0, import_react33.useState)(() => new import_react_query35.QueryClient());
8010
+ const queryClient = (0, import_react33.useContext)(import_react_query39.QueryClientContext);
8011
+ const [fallbackQueryClient] = (0, import_react33.useState)(() => new import_react_query39.QueryClient());
7682
8012
  const venue = options == null ? void 0 : options.venue;
7683
8013
  const venueEventId = options == null ? void 0 : options.venueEventId;
7684
8014
  const search = options == null ? void 0 : options.search;
@@ -7705,7 +8035,7 @@ function useVenueMarkets(options) {
7705
8035
  if (enabled && !client) {
7706
8036
  throw new Error("useVenueMarkets must be used within an <AggProvider>");
7707
8037
  }
7708
- const query = (0, import_react_query35.useInfiniteQuery)(
8038
+ const query = (0, import_react_query39.useInfiniteQuery)(
7709
8039
  {
7710
8040
  queryKey: [
7711
8041
  "venue-markets",
@@ -7816,13 +8146,13 @@ function useEnrichedVenueEvent(options) {
7816
8146
  }
7817
8147
 
7818
8148
  // src/use-venue-events.ts
7819
- var import_react_query36 = require("@tanstack/react-query");
8149
+ var import_react_query40 = require("@tanstack/react-query");
7820
8150
  var import_react35 = require("react");
7821
8151
  function useVenueEvents(options) {
7822
8152
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7823
8153
  const client = (0, import_react35.useContext)(AggClientContext);
7824
- const queryClient = (0, import_react35.useContext)(import_react_query36.QueryClientContext);
7825
- const [fallbackQueryClient] = (0, import_react35.useState)(() => new import_react_query36.QueryClient());
8154
+ const queryClient = (0, import_react35.useContext)(import_react_query40.QueryClientContext);
8155
+ const [fallbackQueryClient] = (0, import_react35.useState)(() => new import_react_query40.QueryClient());
7826
8156
  const venues = options == null ? void 0 : options.venues;
7827
8157
  const search = options == null ? void 0 : options.search;
7828
8158
  const categoryIds = options == null ? void 0 : options.categoryIds;
@@ -7849,7 +8179,7 @@ function useVenueEvents(options) {
7849
8179
  if (enabled && !client) {
7850
8180
  throw new Error("useVenueEvents must be used within an <AggProvider>");
7851
8181
  }
7852
- const query = (0, import_react_query36.useInfiniteQuery)(
8182
+ const query = (0, import_react_query40.useInfiniteQuery)(
7853
8183
  {
7854
8184
  queryKey: [
7855
8185
  queryKeyScope,
@@ -7896,7 +8226,7 @@ function useVenueEvents(options) {
7896
8226
  return (_a2 = lastPage.nextCursor) != null ? _a2 : void 0;
7897
8227
  },
7898
8228
  // TODO: RMIK - Comment out to show skeletons on category switch
7899
- placeholderData: import_react_query36.keepPreviousData,
8229
+ placeholderData: import_react_query40.keepPreviousData,
7900
8230
  enabled: enabled && !!client
7901
8231
  },
7902
8232
  queryClient != null ? queryClient : fallbackQueryClient
@@ -7938,7 +8268,7 @@ function useVenueEvents(options) {
7938
8268
  }
7939
8269
 
7940
8270
  // src/use-venue-market-midpoints.ts
7941
- var import_react_query37 = require("@tanstack/react-query");
8271
+ var import_react_query41 = require("@tanstack/react-query");
7942
8272
  var normalizeVenueMarketIds2 = (venueMarketIds) => {
7943
8273
  return [
7944
8274
  ...new Set(venueMarketIds.map((venueMarketId) => venueMarketId.trim()).filter(Boolean))
@@ -7977,7 +8307,7 @@ function useVenueMarketMidpoints(options) {
7977
8307
  const enabled = (_a = options.enabled) != null ? _a : true;
7978
8308
  const requestedVenueMarketIds = normalizeVenueMarketIds2(options.venueMarketIds);
7979
8309
  const maxMidpointIdsPerRequest = (_b = options.maxMidpointIdsPerRequest) != null ? _b : configuredMaxMidpointIdsPerRequest;
7980
- const query = (0, import_react_query37.useQuery)({
8310
+ const query = (0, import_react_query41.useQuery)({
7981
8311
  queryKey: requestedVenueMarketIds.length ? ["venue-market-midpoints", requestedVenueMarketIds, maxMidpointIdsPerRequest] : ["venue-market-midpoints", "__disabled__"],
7982
8312
  queryFn: (_0) => __async(null, [_0], function* ({ signal }) {
7983
8313
  if (requestedVenueMarketIds.length === 0) {
@@ -7993,7 +8323,7 @@ function useVenueMarketMidpoints(options) {
7993
8323
  gcTime: 5 * 6e4,
7994
8324
  refetchOnWindowFocus: false,
7995
8325
  retry: 1,
7996
- placeholderData: import_react_query37.keepPreviousData
8326
+ placeholderData: import_react_query41.keepPreviousData
7997
8327
  });
7998
8328
  const midpointRows = (_d = (_c = query.data) == null ? void 0 : _c.data) != null ? _d : [];
7999
8329
  const midpointsByVenueMarketId = mapMidpointsByVenueMarketId(midpointRows);
@@ -8244,12 +8574,12 @@ function useVisibleIds(options = {}) {
8244
8574
  }
8245
8575
 
8246
8576
  // src/use-app-config.ts
8247
- var import_react_query38 = require("@tanstack/react-query");
8577
+ var import_react_query42 = require("@tanstack/react-query");
8248
8578
  var FIVE_MINUTES = 5 * 60 * 1e3;
8249
8579
  var APP_CONFIG_QUERY_KEY = ["agg", "app-config"];
8250
8580
  function useAppConfig() {
8251
8581
  const client = useAggClient();
8252
- const query = (0, import_react_query38.useQuery)({
8582
+ const query = (0, import_react_query42.useQuery)({
8253
8583
  queryKey: APP_CONFIG_QUERY_KEY,
8254
8584
  queryFn: () => client.getAppConfig(),
8255
8585
  staleTime: FIVE_MINUTES
@@ -8261,8 +8591,8 @@ function useAppConfig() {
8261
8591
  });
8262
8592
  }
8263
8593
  function useCachedAppConfig() {
8264
- const queryClient = (0, import_react_query38.useQueryClient)();
8265
- const query = (0, import_react_query38.useQuery)({
8594
+ const queryClient = (0, import_react_query42.useQueryClient)();
8595
+ const query = (0, import_react_query42.useQuery)({
8266
8596
  queryKey: APP_CONFIG_QUERY_KEY,
8267
8597
  enabled: false,
8268
8598
  initialData: () => queryClient.getQueryData(APP_CONFIG_QUERY_KEY),
@@ -8359,6 +8689,7 @@ var toAppConfigResult = (query) => {
8359
8689
  useAppConfig,
8360
8690
  useArbFeed,
8361
8691
  useCachedAppConfig,
8692
+ useCancelManagedOrder,
8362
8693
  useCategories,
8363
8694
  useCategoryChildren,
8364
8695
  useDebouncedValue,
@@ -8398,6 +8729,7 @@ var toAppConfigResult = (query) => {
8398
8729
  useOrderBook,
8399
8730
  useOrderbookQuote,
8400
8731
  useOrders,
8732
+ usePlaceLimitOrder,
8401
8733
  usePositions,
8402
8734
  useQueryClient,
8403
8735
  useQuoteManaged,
@@ -8417,8 +8749,10 @@ var toAppConfigResult = (query) => {
8417
8749
  useUserHoldings,
8418
8750
  useVenueEvent,
8419
8751
  useVenueEvents,
8752
+ useVenueKeyStatus,
8420
8753
  useVenueMarketMidpoints,
8421
8754
  useVenueMarkets,
8755
+ useVenueSellQuotes,
8422
8756
  useViewportMidpoints,
8423
8757
  useVisibleIds,
8424
8758
  useWithdrawEstimate,
@@ -8426,5 +8760,6 @@ var toAppConfigResult = (query) => {
8426
8760
  useWithdrawManaged,
8427
8761
  useWithdrawPreview,
8428
8762
  useWithdrawalLifecycle,
8429
- userActivityQueryKeys
8763
+ userActivityQueryKeys,
8764
+ venueKeyQueryKeys
8430
8765
  });