@agg-build/hooks 4.0.1 → 4.5.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
 
@@ -289,6 +292,20 @@ function LinkPartnerAccount({
289
292
  To quote and fill, take the quote from `useSmartRoute` and pass its `quoteId` to
290
293
  `useExecuteManaged`.
291
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
+
292
309
  > **Removed in v4.** `useQuoteManaged` was deleted — it wrapped
293
310
  > `client.quoteManaged()`, whose endpoint (`POST /execution/quote`) does not
294
311
  > exist on the API, so the call only ever returned 404.
@@ -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";