@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 +30 -13
- package/dist/{chunk-AZYAQIZB.mjs → chunk-IHMZHA2W.mjs} +1 -1
- package/dist/{chunk-SC6X5TL4.mjs → chunk-LVOL27OZ.mjs} +338 -49
- package/dist/{chunk-BR6NZSXN.mjs → chunk-O4RM4KKO.mjs} +1 -1
- package/dist/deposit.js +54 -5
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +481 -9
- package/dist/index.d.ts +481 -9
- package/dist/index.js +1014 -81
- package/dist/index.mjs +655 -22
- package/dist/withdraw.js +54 -5
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
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
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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-
|
|
14
|
+
} from "./chunk-LVOL27OZ.mjs";
|
|
15
15
|
|
|
16
16
|
// src/withdraw/use-withdraw-flow.ts
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from "react";
|