Skip to main content
This library provides higher level React hooks to abstract some of the state management for you. You will still need to use the @echoxyz/sonar-core library for some parts of the integration, and to import types.

Hooks

useSonarAuth

A hook to handle the OAuth flow for the user. Returns

useSonarClient

A hook to get a reference to the underlying SonarClient from the @echoxyz/sonar-core library. Returns

useSonarEntity

A hook to fetch the state of a user’s Sonar entity based on their connected wallet address. The hook will only start loading once the entityID or walletAddress is defined. Arguments Returns

useSonarEntities

A hook to list all available entities for the authenticated user. Arguments Returns

useSonarPurchase

A hook to run pre-purchase checks and return functions required to complete the purchase flow. Arguments Returns

useSonarProfile

A hook to fetch the authenticated user’s profile information. Returns

useEntityInvestmentHistory

A hook to fetch the authenticated user’s investment history, showing all Echo private group investments they have participated in. This automatically fetches when the user is authenticated and resets when they log out. Returns Example

useCommitmentData

A hook to fetch commitment data for a sale, with optional polling for live updates. This calls a public API endpoint, so the client does not need to be authenticated. Arguments Returns