@agg-build/hooks 1.0.0 → 1.0.2

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.mjs CHANGED
@@ -1,3 +1,11 @@
1
+ import {
2
+ useRampQuotes,
3
+ useRampSession
4
+ } from "./chunk-EB64HHYM.mjs";
5
+ import {
6
+ useWithdrawFlow,
7
+ useWithdrawalLifecycle
8
+ } from "./chunk-NOYHQUW2.mjs";
1
9
  import {
2
10
  AggAuthContext,
3
11
  AggBalanceProvider,
@@ -65,17 +73,16 @@ import {
65
73
  useOnBalanceUpdate,
66
74
  useOnOrderSubmitted,
67
75
  useOnRedeemEvent,
76
+ useOnWithdrawalLifecycle,
68
77
  usePositions,
69
78
  useQuoteManaged,
70
- useRampQuotes,
71
- useRampSession,
72
79
  useRedeem,
73
80
  useRedeemEligibleCount,
74
81
  useSdkLabels,
75
82
  useSdkUiConfig,
76
83
  useSyncBalances,
77
84
  useWithdrawManaged
78
- } from "./chunk-CDPQERUC.mjs";
85
+ } from "./chunk-V6VNA7MX.mjs";
79
86
 
80
87
  // src/index.ts
81
88
  import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
@@ -833,7 +840,9 @@ function useLiveOutcomePrices(venueMarkets) {
833
840
  continue;
834
841
  }
835
842
  const liveMidpoint = liveByOutcomeId.get(outcome.id);
836
- prices.set(outcome.id, liveMidpoint != null ? liveMidpoint : outcome.price);
843
+ if (liveMidpoint != null) {
844
+ prices.set(outcome.id, liveMidpoint);
845
+ }
837
846
  }
838
847
  }
839
848
  prevRef.current = { fingerprint, prices };
@@ -881,29 +890,43 @@ function useMidpoints(venueMarkets) {
881
890
  refetchOnWindowFocus: false,
882
891
  refetchOnReconnect: false
883
892
  });
884
- const prices = useMemo7(() => {
885
- var _a, _b, _c, _d;
893
+ const result = useMemo7(() => {
894
+ var _a, _b, _c, _d, _e, _f;
886
895
  const map = /* @__PURE__ */ new Map();
887
- if (!(data == null ? void 0 : data.data) || !venueMarkets) return map;
896
+ const venueMap = /* @__PURE__ */ new Map();
897
+ if (!(data == null ? void 0 : data.data) || !venueMarkets) return { map, venueMap };
888
898
  for (const item of data.data) {
889
899
  if ((_a = item.outcomes) == null ? void 0 : _a.length) {
890
900
  for (const o of item.outcomes) {
891
901
  if (o.midpoint != null) {
892
902
  map.set(o.venueMarketOutcomeId, o.midpoint);
903
+ if (item.venue) venueMap.set(o.venueMarketOutcomeId, item.venue);
893
904
  }
894
905
  }
895
906
  if ((_b = item.matched) == null ? void 0 : _b.length) {
896
- for (const m of item.matched) {
897
- if (m.midpoint != null) {
898
- const market = venueMarkets.find((vm) => vm.id === item.venueMarketId);
899
- if (!market) continue;
907
+ const market = venueMarkets.find((vm) => vm.id === item.venueMarketId);
908
+ if (market) {
909
+ const primaryYesOutcome = market.venueMarketOutcomes.find(
910
+ (o) => {
911
+ var _a2;
912
+ return ((_a2 = o.label) == null ? void 0 : _a2.toLowerCase()) === "yes";
913
+ }
914
+ );
915
+ const primaryYesMidpoint = primaryYesOutcome ? (_c = map.get(primaryYesOutcome.id)) != null ? _c : null : null;
916
+ let bestMatchedMidpoint = null;
917
+ let bestMatchedVenue = null;
918
+ for (const m of item.matched) {
919
+ if (m.midpoint == null) continue;
920
+ if (bestMatchedMidpoint == null || m.midpoint < bestMatchedMidpoint) {
921
+ bestMatchedMidpoint = m.midpoint;
922
+ bestMatchedVenue = (_d = m.venue) != null ? _d : null;
923
+ }
924
+ }
925
+ if (bestMatchedMidpoint != null && (primaryYesMidpoint == null || bestMatchedMidpoint < primaryYesMidpoint)) {
900
926
  for (const outcome of market.venueMarketOutcomes) {
901
- const existing = map.get(outcome.id);
902
- const isYes = ((_c = outcome.label) == null ? void 0 : _c.toLowerCase()) === "yes";
903
- const matchedPrice = isYes ? m.midpoint : 1 - m.midpoint;
904
- if (existing == null || isYes && matchedPrice > existing || !isYes && matchedPrice < existing) {
905
- map.set(outcome.id, matchedPrice);
906
- }
927
+ const isYes = ((_e = outcome.label) == null ? void 0 : _e.toLowerCase()) === "yes";
928
+ map.set(outcome.id, isYes ? bestMatchedMidpoint : 1 - bestMatchedMidpoint);
929
+ if (bestMatchedVenue) venueMap.set(outcome.id, bestMatchedVenue);
907
930
  }
908
931
  }
909
932
  }
@@ -914,14 +937,19 @@ function useMidpoints(venueMarkets) {
914
937
  const market = venueMarkets.find((vm) => vm.id === item.venueMarketId);
915
938
  if (!market) continue;
916
939
  for (const outcome of market.venueMarketOutcomes) {
917
- const isYes = ((_d = outcome.label) == null ? void 0 : _d.toLowerCase()) === "yes";
940
+ const isYes = ((_f = outcome.label) == null ? void 0 : _f.toLowerCase()) === "yes";
918
941
  map.set(outcome.id, isYes ? item.midpoint : 1 - item.midpoint);
942
+ if (item.venue) venueMap.set(outcome.id, item.venue);
919
943
  }
920
944
  }
921
945
  }
922
- return map;
946
+ return { map, venueMap };
923
947
  }, [data, venueMarkets]);
924
- return { prices, isLoading: isLoading && ids.length > 0 };
948
+ return {
949
+ prices: result.map,
950
+ venueByOutcomeId: result.venueMap,
951
+ isLoading: isLoading && ids.length > 0
952
+ };
925
953
  }
926
954
 
927
955
  // src/use-market-orderbook.ts
@@ -1593,6 +1621,7 @@ function useVenueEvents(options) {
1593
1621
  if (!lastPage.hasMore) return void 0;
1594
1622
  return (_a2 = lastPage.nextCursor) != null ? _a2 : void 0;
1595
1623
  },
1624
+ // TODO: RMIK - Comment out to show skeletons on category switch
1596
1625
  placeholderData: keepPreviousData6,
1597
1626
  enabled: enabled && !!client
1598
1627
  },
@@ -1726,6 +1755,12 @@ function computePriceGaps(input) {
1726
1755
 
1727
1756
  // src/use-viewport-midpoints.ts
1728
1757
  import { useEffect as useEffect8, useMemo as useMemo10, useRef as useRef4, useState as useState7 } from "react";
1758
+ var normalizeOutcomeLabel = (value) => value.trim().toLowerCase();
1759
+ var resolveYesMidpoint = (outcomes) => {
1760
+ if (!(outcomes == null ? void 0 : outcomes.length)) return void 0;
1761
+ const yesOutcome = outcomes.find((outcome) => normalizeOutcomeLabel(outcome.label) === "yes");
1762
+ return yesOutcome == null ? void 0 : yesOutcome.midpoint;
1763
+ };
1729
1764
  var resolveUncachedVisibleMarketIds = (visibleMarkets, cache, inFlightIds) => {
1730
1765
  const idsToFetch = [];
1731
1766
  for (const market of visibleMarkets) {
@@ -1736,21 +1771,24 @@ var resolveUncachedVisibleMarketIds = (visibleMarkets, cache, inFlightIds) => {
1736
1771
  return idsToFetch;
1737
1772
  };
1738
1773
  var buildCachedMidpointEntries = (requestedVenueMarketIds, rows) => {
1739
- var _a, _b;
1774
+ var _a, _b, _c;
1740
1775
  const rowsByVenueMarketId = new Map(rows.map((item) => [item.venueMarketId, item]));
1741
1776
  const nextCacheEntries = /* @__PURE__ */ new Map();
1742
1777
  for (const venueMarketId of requestedVenueMarketIds) {
1743
1778
  const item = rowsByVenueMarketId.get(venueMarketId);
1744
- nextCacheEntries.set(venueMarketId, {
1745
- midpoint: (_a = item == null ? void 0 : item.midpoint) != null ? _a : null,
1746
- matched: ((_b = item == null ? void 0 : item.matched) != null ? _b : []).map((matched) => {
1747
- var _a2;
1748
- return {
1779
+ const yesMidpoint = resolveYesMidpoint(item == null ? void 0 : item.outcomes);
1780
+ nextCacheEntries.set(venueMarketId, __spreadProps(__spreadValues({}, (item == null ? void 0 : item.venue) ? { venue: item.venue } : {}), {
1781
+ midpoint: (_a = yesMidpoint != null ? yesMidpoint : item == null ? void 0 : item.midpoint) != null ? _a : null,
1782
+ spread: (_b = item == null ? void 0 : item.spread) != null ? _b : null,
1783
+ matched: ((_c = item == null ? void 0 : item.matched) != null ? _c : []).map((matched) => {
1784
+ var _a2, _b2;
1785
+ return __spreadValues({
1749
1786
  venueMarketId: matched.venueMarketId,
1750
- midpoint: (_a2 = matched.midpoint) != null ? _a2 : null
1751
- };
1787
+ midpoint: (_a2 = matched.midpoint) != null ? _a2 : null,
1788
+ spread: (_b2 = matched.spread) != null ? _b2 : null
1789
+ }, matched.venue ? { venue: matched.venue } : {});
1752
1790
  })
1753
- });
1791
+ }));
1754
1792
  }
1755
1793
  return nextCacheEntries;
1756
1794
  };
@@ -1788,25 +1826,34 @@ function useViewportMidpoints(visibleMarkets) {
1788
1826
  cancelled = true;
1789
1827
  };
1790
1828
  }, [visibleFp, cache]);
1791
- const prices = useMemo10(() => {
1792
- var _a;
1829
+ const { prices, venueByOutcomeId } = useMemo10(() => {
1830
+ var _a, _b, _c, _d, _e, _f;
1793
1831
  const map = /* @__PURE__ */ new Map();
1832
+ const venueMap = /* @__PURE__ */ new Map();
1794
1833
  for (const market of visibleMarkets) {
1795
1834
  const entry = cache.get(market.id);
1796
1835
  if (!entry) continue;
1797
- const candidates = [];
1798
- if (entry.midpoint != null) candidates.push(entry.midpoint);
1799
- for (const m of entry.matched) if (m.midpoint != null) candidates.push(m.midpoint);
1800
- if (!candidates.length) continue;
1801
- const mid = Math.max(...candidates);
1836
+ let mid = entry.midpoint;
1837
+ let midVenue = (_a = entry.venue) != null ? _a : market.venue;
1838
+ for (const m of entry.matched) {
1839
+ const matchedFromCache = (_b = cache.get(m.venueMarketId)) == null ? void 0 : _b.midpoint;
1840
+ const candidateMidpoint = matchedFromCache != null ? matchedFromCache : m.midpoint;
1841
+ if (candidateMidpoint == null) continue;
1842
+ if (mid == null || candidateMidpoint < mid) {
1843
+ mid = candidateMidpoint;
1844
+ midVenue = (_e = (_d = (_c = cache.get(m.venueMarketId)) == null ? void 0 : _c.venue) != null ? _d : m.venue) != null ? _e : market.venue;
1845
+ }
1846
+ }
1847
+ if (mid == null) continue;
1802
1848
  for (const outcome of market.venueMarketOutcomes) {
1803
- const isYes = ((_a = outcome.label) == null ? void 0 : _a.toLowerCase()) === "yes";
1849
+ const isYes = ((_f = outcome.label) == null ? void 0 : _f.toLowerCase()) === "yes";
1804
1850
  map.set(outcome.id, isYes ? mid : 1 - mid);
1851
+ venueMap.set(outcome.id, midVenue);
1805
1852
  }
1806
1853
  }
1807
- return map;
1854
+ return { prices: map, venueByOutcomeId: venueMap };
1808
1855
  }, [cache, visibleMarkets]);
1809
- return { prices };
1856
+ return { prices, venueByOutcomeId };
1810
1857
  }
1811
1858
 
1812
1859
  // src/use-visible-ids.ts
@@ -1983,6 +2030,7 @@ export {
1983
2030
  useOnBalanceUpdate,
1984
2031
  useOnOrderSubmitted,
1985
2032
  useOnRedeemEvent,
2033
+ useOnWithdrawalLifecycle,
1986
2034
  useOrderBook,
1987
2035
  useOrderbookQuote,
1988
2036
  useOrders,
@@ -2006,5 +2054,7 @@ export {
2006
2054
  useVenueMarkets,
2007
2055
  useViewportMidpoints,
2008
2056
  useVisibleIds,
2009
- useWithdrawManaged
2057
+ useWithdrawFlow,
2058
+ useWithdrawManaged,
2059
+ useWithdrawalLifecycle
2010
2060
  };
@@ -233,14 +233,4 @@ declare function useDepositAddresses(options?: UseDepositAddressesOptions): {
233
233
  promise: Promise<DepositAddressesResponse>;
234
234
  };
235
235
 
236
- interface UseSyncBalancesOptions {
237
- onSuccess?: () => void;
238
- onError?: (error: Error) => void;
239
- }
240
- /**
241
- * Mutation hook for triggering an on-chain balance sync.
242
- * On success, invalidates balances queries.
243
- */
244
- declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
245
-
246
- export { type UseDepositAddressesOptions as U, type UseSyncBalancesOptions as a, useSyncBalances as b, getDepositAddress as g, useDepositAddresses as u };
236
+ export { type UseDepositAddressesOptions as U, getDepositAddress as g, useDepositAddresses as u };
@@ -233,14 +233,4 @@ declare function useDepositAddresses(options?: UseDepositAddressesOptions): {
233
233
  promise: Promise<DepositAddressesResponse>;
234
234
  };
235
235
 
236
- interface UseSyncBalancesOptions {
237
- onSuccess?: () => void;
238
- onError?: (error: Error) => void;
239
- }
240
- /**
241
- * Mutation hook for triggering an on-chain balance sync.
242
- * On success, invalidates balances queries.
243
- */
244
- declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
245
-
246
- export { type UseDepositAddressesOptions as U, type UseSyncBalancesOptions as a, useSyncBalances as b, getDepositAddress as g, useDepositAddresses as u };
236
+ export { type UseDepositAddressesOptions as U, getDepositAddress as g, useDepositAddresses as u };
@@ -0,0 +1,14 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import * as _agg_build_sdk from '@agg-build/sdk';
3
+
4
+ interface UseSyncBalancesOptions {
5
+ onSuccess?: () => void;
6
+ onError?: (error: Error) => void;
7
+ }
8
+ /**
9
+ * Mutation hook for triggering an on-chain balance sync.
10
+ * On success, invalidates balances queries.
11
+ */
12
+ declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
13
+
14
+ export { type UseSyncBalancesOptions as U, useSyncBalances as u };
@@ -0,0 +1,14 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import * as _agg_build_sdk from '@agg-build/sdk';
3
+
4
+ interface UseSyncBalancesOptions {
5
+ onSuccess?: () => void;
6
+ onError?: (error: Error) => void;
7
+ }
8
+ /**
9
+ * Mutation hook for triggering an on-chain balance sync.
10
+ * On success, invalidates balances queries.
11
+ */
12
+ declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
13
+
14
+ export { type UseSyncBalancesOptions as U, useSyncBalances as u };
@@ -0,0 +1,293 @@
1
+ import * as _agg_build_sdk from '@agg-build/sdk';
2
+ import { WsWithdrawalLifecycleStatus, WsWithdrawalLifecycleLeg, WithdrawManagedResponse, WithdrawManagedParams } from '@agg-build/sdk';
3
+ import * as _tanstack_react_query from '@tanstack/react-query';
4
+ export { U as UseDepositAddressesOptions, u as useDepositAddresses } from './use-deposit-addresses-B9ICS-3U.mjs';
5
+
6
+ type WithdrawSelectOption = {
7
+ value: string;
8
+ label: string;
9
+ };
10
+ type WithdrawSummary = {
11
+ /**
12
+ * The amount the user submitted for withdrawal — NOT a confirmed payout
13
+ * figure. The API today returns `pricingStatus: "unquoted"` with no fee
14
+ * or net-output guarantee, so labeling this "received" was misleading.
15
+ * The label string is "Amount" until the multi-stable quote layer ships.
16
+ */
17
+ amountReceived: string;
18
+ network: string;
19
+ toWallet: string;
20
+ fees: string;
21
+ };
22
+ interface UseWithdrawFlowResult {
23
+ open: boolean;
24
+ onOpenChange: (open: boolean) => void;
25
+ withdrawFlow: {
26
+ balance: number;
27
+ balanceDisplay: string;
28
+ amount: string;
29
+ destinationWallet: string;
30
+ tokenOptions: WithdrawSelectOption[];
31
+ networkOptions: WithdrawSelectOption[];
32
+ selectedToken: string;
33
+ selectedNetwork: string;
34
+ purchaseSummary: WithdrawSummary;
35
+ /**
36
+ * The id returned by `POST /execution/withdraw-managed` once the user
37
+ * has submitted the flow — used by the success step to subscribe to
38
+ * `withdrawal_lifecycle` WS events. `null` until submission succeeds
39
+ * and reset to `null` when the modal closes.
40
+ */
41
+ withdrawalId: string | null;
42
+ };
43
+ onWithdrawDestinationChange: (address: string) => void;
44
+ onWithdrawAmountChange: (amount: string) => void;
45
+ onWithdrawTokenChange: (token: string) => void;
46
+ onWithdrawNetworkChange: (network: string) => void;
47
+ onMaxClick: () => void;
48
+ onSelectWithdrawProvider: (providerId: string) => Promise<void>;
49
+ onDoneWithdraw: () => void;
50
+ }
51
+ interface UseWithdrawFlowOptions {
52
+ open: boolean;
53
+ onOpenChange: (open: boolean) => void;
54
+ }
55
+ declare function useWithdrawFlow(options: UseWithdrawFlowOptions): UseWithdrawFlowResult;
56
+
57
+ /**
58
+ * Latest lifecycle snapshot for a single withdrawal, materialized from the
59
+ * most recent `WsWithdrawalLifecycleEvent` whose `withdrawalId` matches.
60
+ *
61
+ * The wire format is intentionally additive (legs may arrive partial), so
62
+ * `legs` reflects the latest snapshot the server emitted — earlier per-leg
63
+ * deltas are not re-merged on the client. Consumers should treat `legs` as
64
+ * "last known truth" rather than a derived rollup.
65
+ */
66
+ interface WithdrawalLifecycleState {
67
+ /** True until the first lifecycle event for this withdrawal arrives. */
68
+ pending: boolean;
69
+ /** Top-level status, or `null` until the first event arrives. */
70
+ status: WsWithdrawalLifecycleStatus | null;
71
+ /** Whether `status` is a terminal state (`completed` / `partial` / `failed`). */
72
+ terminal: boolean;
73
+ /** Last leg delta (the leg whose flip triggered the most recent event). */
74
+ lastLeg: WsWithdrawalLifecycleLeg | null;
75
+ /** All legs at the moment of the most recent event (server snapshot). */
76
+ legs: WsWithdrawalLifecycleLeg[];
77
+ /** Failure reason for terminal `failed` / `partial`. */
78
+ errorMessage: string | null;
79
+ /** Server timestamp (ms) of the most recent event. */
80
+ timestamp: number | null;
81
+ }
82
+ interface UseWithdrawalLifecycleResult {
83
+ /** Latest lifecycle snapshot for the watched `withdrawalId`. */
84
+ state: WithdrawalLifecycleState;
85
+ /** Reset to the initial pre-event state — call when the modal is closed or a new flow starts. */
86
+ reset: () => void;
87
+ }
88
+ /**
89
+ * Subscribes to `withdrawal_lifecycle` WS events for a single `withdrawalId`
90
+ * and exposes the latest snapshot. Returns a stable `pending` initial state
91
+ * until the first matching event arrives.
92
+ *
93
+ * Pass `null` for `withdrawalId` to disable the subscription (e.g. before
94
+ * the user has submitted a withdrawal). Switching the `withdrawalId` resets
95
+ * the state so a stale snapshot from a prior withdrawal can never bleed
96
+ * across.
97
+ *
98
+ * **Backfill behavior**: on mount with a non-null `withdrawalId`, and again
99
+ * whenever the WS connection re-opens, the hook calls
100
+ * `GET /execution/withdrawals/:id` to recover any lifecycle events that fired
101
+ * before the listener was attached or while the socket was disconnected. WS
102
+ * events always win over REST snapshots (REST stamps as `timestamp: 0`), so a
103
+ * race between the two never regresses to a stale state.
104
+ */
105
+ declare function useWithdrawalLifecycle(withdrawalId: string | null): UseWithdrawalLifecycleResult;
106
+
107
+ interface UseWithdrawManagedOptions {
108
+ onSuccess?: (data: WithdrawManagedResponse) => void;
109
+ onError?: (error: Error) => void;
110
+ }
111
+ /**
112
+ * Mutation hook for withdrawing funds from managed wallets.
113
+ * On success, invalidates balances queries.
114
+ */
115
+ declare function useWithdrawManaged(options?: UseWithdrawManagedOptions): _tanstack_react_query.UseMutationResult<WithdrawManagedResponse, Error, WithdrawManagedParams, unknown>;
116
+
117
+ interface UseManagedBalancesOptions {
118
+ enabled?: boolean;
119
+ }
120
+ /**
121
+ * Query hook for fetching unified managed wallet balances across all chains.
122
+ */
123
+ declare function useManagedBalances(options?: UseManagedBalancesOptions): {
124
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
125
+ data: _agg_build_sdk.UnifiedBalanceResponse;
126
+ error: Error;
127
+ isError: true;
128
+ isPending: false;
129
+ isLoading: false;
130
+ isLoadingError: false;
131
+ isRefetchError: true;
132
+ isSuccess: false;
133
+ isPlaceholderData: false;
134
+ status: "error";
135
+ dataUpdatedAt: number;
136
+ errorUpdatedAt: number;
137
+ failureCount: number;
138
+ failureReason: Error | null;
139
+ errorUpdateCount: number;
140
+ isFetched: boolean;
141
+ isFetchedAfterMount: boolean;
142
+ isFetching: boolean;
143
+ isInitialLoading: boolean;
144
+ isPaused: boolean;
145
+ isRefetching: boolean;
146
+ isStale: boolean;
147
+ isEnabled: boolean;
148
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
149
+ fetchStatus: _tanstack_react_query.FetchStatus;
150
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
151
+ } | {
152
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
153
+ data: _agg_build_sdk.UnifiedBalanceResponse;
154
+ error: null;
155
+ isError: false;
156
+ isPending: false;
157
+ isLoading: false;
158
+ isLoadingError: false;
159
+ isRefetchError: false;
160
+ isSuccess: true;
161
+ isPlaceholderData: false;
162
+ status: "success";
163
+ dataUpdatedAt: number;
164
+ errorUpdatedAt: number;
165
+ failureCount: number;
166
+ failureReason: Error | null;
167
+ errorUpdateCount: number;
168
+ isFetched: boolean;
169
+ isFetchedAfterMount: boolean;
170
+ isFetching: boolean;
171
+ isInitialLoading: boolean;
172
+ isPaused: boolean;
173
+ isRefetching: boolean;
174
+ isStale: boolean;
175
+ isEnabled: boolean;
176
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
177
+ fetchStatus: _tanstack_react_query.FetchStatus;
178
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
179
+ } | {
180
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
181
+ data: undefined;
182
+ error: Error;
183
+ isError: true;
184
+ isPending: false;
185
+ isLoading: false;
186
+ isLoadingError: true;
187
+ isRefetchError: false;
188
+ isSuccess: false;
189
+ isPlaceholderData: false;
190
+ status: "error";
191
+ dataUpdatedAt: number;
192
+ errorUpdatedAt: number;
193
+ failureCount: number;
194
+ failureReason: Error | null;
195
+ errorUpdateCount: number;
196
+ isFetched: boolean;
197
+ isFetchedAfterMount: boolean;
198
+ isFetching: boolean;
199
+ isInitialLoading: boolean;
200
+ isPaused: boolean;
201
+ isRefetching: boolean;
202
+ isStale: boolean;
203
+ isEnabled: boolean;
204
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
205
+ fetchStatus: _tanstack_react_query.FetchStatus;
206
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
207
+ } | {
208
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
209
+ data: undefined;
210
+ error: null;
211
+ isError: false;
212
+ isPending: true;
213
+ isLoading: true;
214
+ isLoadingError: false;
215
+ isRefetchError: false;
216
+ isSuccess: false;
217
+ isPlaceholderData: false;
218
+ status: "pending";
219
+ dataUpdatedAt: number;
220
+ errorUpdatedAt: number;
221
+ failureCount: number;
222
+ failureReason: Error | null;
223
+ errorUpdateCount: number;
224
+ isFetched: boolean;
225
+ isFetchedAfterMount: boolean;
226
+ isFetching: boolean;
227
+ isInitialLoading: boolean;
228
+ isPaused: boolean;
229
+ isRefetching: boolean;
230
+ isStale: boolean;
231
+ isEnabled: boolean;
232
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
233
+ fetchStatus: _tanstack_react_query.FetchStatus;
234
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
235
+ } | {
236
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
237
+ data: undefined;
238
+ error: null;
239
+ isError: false;
240
+ isPending: true;
241
+ isLoadingError: false;
242
+ isRefetchError: false;
243
+ isSuccess: false;
244
+ isPlaceholderData: false;
245
+ status: "pending";
246
+ dataUpdatedAt: number;
247
+ errorUpdatedAt: number;
248
+ failureCount: number;
249
+ failureReason: Error | null;
250
+ errorUpdateCount: number;
251
+ isFetched: boolean;
252
+ isFetchedAfterMount: boolean;
253
+ isFetching: boolean;
254
+ isLoading: boolean;
255
+ isInitialLoading: boolean;
256
+ isPaused: boolean;
257
+ isRefetching: boolean;
258
+ isStale: boolean;
259
+ isEnabled: boolean;
260
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
261
+ fetchStatus: _tanstack_react_query.FetchStatus;
262
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
263
+ } | {
264
+ balances: _agg_build_sdk.UnifiedBalanceResponse | undefined;
265
+ data: _agg_build_sdk.UnifiedBalanceResponse;
266
+ isError: false;
267
+ error: null;
268
+ isPending: false;
269
+ isLoading: false;
270
+ isLoadingError: false;
271
+ isRefetchError: false;
272
+ isSuccess: true;
273
+ isPlaceholderData: true;
274
+ status: "success";
275
+ dataUpdatedAt: number;
276
+ errorUpdatedAt: number;
277
+ failureCount: number;
278
+ failureReason: Error | null;
279
+ errorUpdateCount: number;
280
+ isFetched: boolean;
281
+ isFetchedAfterMount: boolean;
282
+ isFetching: boolean;
283
+ isInitialLoading: boolean;
284
+ isPaused: boolean;
285
+ isRefetching: boolean;
286
+ isStale: boolean;
287
+ isEnabled: boolean;
288
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_agg_build_sdk.UnifiedBalanceResponse, Error>>;
289
+ fetchStatus: _tanstack_react_query.FetchStatus;
290
+ promise: Promise<_agg_build_sdk.UnifiedBalanceResponse>;
291
+ };
292
+
293
+ export { type UseManagedBalancesOptions, type UseWithdrawFlowOptions, type UseWithdrawFlowResult, type UseWithdrawManagedOptions, type UseWithdrawalLifecycleResult, type WithdrawalLifecycleState, useManagedBalances, useWithdrawFlow, useWithdrawManaged, useWithdrawalLifecycle };