@agg-build/hooks 4.0.0 → 4.4.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/README.md CHANGED
@@ -31,7 +31,7 @@ npm install @agg-build/sdk @agg-build/hooks
31
31
  ## Quick start
32
32
 
33
33
  ```tsx
34
- import { AggProvider } from "@agg-build/hooks";
34
+ import { AggProvider, QueryClient, QueryClientProvider } from "@agg-build/hooks";
35
35
  import { createAggClient } from "@agg-build/sdk";
36
36
 
37
37
  const client = createAggClient({
@@ -39,18 +39,21 @@ const client = createAggClient({
39
39
  appId: "your-app-id",
40
40
  wsUrl: "wss://ws.agg.market",
41
41
  });
42
+ const queryClient = new QueryClient();
42
43
 
43
44
  export function App() {
44
45
  return (
45
- <AggProvider
46
- client={client}
47
- config={{
48
- general: { locale: "en-US", theme: "dark" },
49
- features: { enableAnimations: true, enableLiveUpdates: true },
50
- }}
51
- >
52
- <YourApp />
53
- </AggProvider>
46
+ <QueryClientProvider client={queryClient}>
47
+ <AggProvider
48
+ client={client}
49
+ config={{
50
+ general: { locale: "en-US", theme: "dark" },
51
+ features: { enableAnimations: true, enableLiveUpdates: true },
52
+ }}
53
+ >
54
+ <YourApp />
55
+ </AggProvider>
56
+ </QueryClientProvider>
54
57
  );
55
58
  }
56
59
  ```
@@ -59,9 +62,9 @@ export function App() {
59
62
  prefer to compose them yourself, the individual providers (`AggSdkProvider`, `AggUiProvider`,
60
63
  `AggBalanceProvider`) are exported too.
61
64
 
62
- > `AggProvider` creates its own internal `QueryClientProvider` if one is not already in the tree,
63
- > so you don't need to install or configure TanStack Query to get started. Drop in your own
64
- > `<QueryClientProvider>` if you want to share a cache with the rest of your app.
65
+ `AggProvider` uses TanStack Query for shared request and live-data caches, so a
66
+ `QueryClientProvider` ancestor is required. The package re-exports `QueryClient` and
67
+ `QueryClientProvider` for hooks-only consumers.
65
68
 
66
69
  ### Signing in with a wallet
67
70
 
@@ -278,8 +281,7 @@ function LinkPartnerAccount({
278
281
 
279
282
  | Hook | Description |
280
283
  | ------------------------------- | -------------------------------------------------------------- |
281
- | `useQuoteManaged(options?)` | Request a managed execution quote (2-min TTL) |
282
- | `useExecuteManaged(options?)` | Execute a previously quoted managed trade |
284
+ | `useExecuteManaged(options?)` | Fill a quote from `useSmartRoute` — see note below |
283
285
  | `useValidateManaged(options?)` | Pre-validate balances/bridge without quoting |
284
286
  | `useWithdrawManaged(options?)` | Withdraw from managed wallets |
285
287
  | `useSyncBalances(options?)` | Trigger on-chain balance sync |
@@ -287,6 +289,27 @@ function LinkPartnerAccount({
287
289
  | `useRedeem()` | Claim winnings from resolved markets |
288
290
  | `useRedeemEligibleCount()` | Count of positions eligible to redeem |
289
291
 
292
+ To quote and fill, take the quote from `useSmartRoute` and pass its `quoteId` to
293
+ `useExecuteManaged`.
294
+
295
+ ```tsx
296
+ const buyRoute = useSmartRoute({
297
+ venueMarketOutcomeId,
298
+ tradeSide: "buy",
299
+ maxSpend: 50,
300
+ });
301
+
302
+ const sellRoute = useSmartRoute({
303
+ venueMarketOutcomeId,
304
+ tradeSide: "sell",
305
+ sellShares: 10,
306
+ });
307
+ ```
308
+
309
+ > **Removed in v4.** `useQuoteManaged` was deleted — it wrapped
310
+ > `client.quoteManaged()`, whose endpoint (`POST /execution/quote`) does not
311
+ > exist on the API, so the call only ever returned 404.
312
+
290
313
  ### Deposits (subpath)
291
314
 
292
315
  Import from `@agg-build/hooks/deposit` to keep wallet-heavy hooks out of your main bundle:
@@ -11,7 +11,7 @@ import {
11
11
  useOnWithdrawalLifecycle,
12
12
  useSyncBalances,
13
13
  useWithdrawManaged
14
- } from "./chunk-SC6X5TL4.mjs";
14
+ } from "./chunk-LVOL27OZ.mjs";
15
15
 
16
16
  // src/withdraw/use-withdraw-flow.ts
17
17
  import { useCallback, useEffect, useMemo, useState } from "react";