Skip to main content
You’ll need: an app ID (Base URL, app IDs & API keys), your site’s origin in the app’s allowed origins, and React 18 or later. Result: a React app with AGG data, sign-in, and a buy that is tracked to a final state.
Install the packages you need. See the Packages overview for what each one does and its peer dependencies. Every layer uses the same client from @agg-build/sdk.

1. Create the client and provider

Mount one AggProvider around your app. Use the hooks export for data hooks, or the UI export to include the UI kit’s toast support; the UI export already includes the hooks provider. Mount AggAuthProvider inside it for the connect button. The example assumes you have a Wagmi configuration in ./wagmi-config and your application component in MyApp.
For the UI kit’s toasts, import AggProvider from @agg-build/ui instead of from @agg-build/hooks. Keep the same client and config props. That component already mounts the hooks provider. UI components go inside MyApp:
See the Event Market Page and Market Details references, and Customize UI for fonts, colors, copy, and slots. Use outcome IDs for trading, charts, orderbooks, and live trades. Arbitrage and midpoint reads use market IDs. Some hook parameter names retain older naming; the table below lists the ID each one expects.
No session means a preview quote. See Quotes.

2. Sign the user in

AuthButton above lets the user sign in through @agg-build/auth. Trading calls use that user’s session through the shared client. See the Connect Button reference and Authentication & sessions for every provider.

3. Buy and track to a final state

The user needs a balance first. See Funding for deposits. No session means a preview quote. See Quotes. Then quote, fill, and poll the execution status until terminal is true.
Stop polling when terminal is true. overallState then reads filled, partially_filled, failed, cancelled, or expired. Read Order lifecycle & statuses for what each state means.

WebSocket endpoint

The SDK and hooks manage the socket, reconnection, resnapshots, and orderbook integrity checks. If you open raw sockets yourself, connect to:
See WebSocket Protocol.

Next steps

Quickstart: REST

The same flow over REST, for backends and agents.

Order lifecycle

Every order status and how to track it.

Real-Time Orderbook

Live orderbook rendering with the SDK, hooks, and UI.

Customize UI

Brand AGG components with CSS variables, labels, formatting, and slots.