React Hooks
The SDK provides React hooks built on TanStack Query for seamless data fetching with caching, background updates, and error handling.Setup
Wrap your app withQueryClientProvider:
DAO Hooks
useDAOs
Fetch all DAOs with pagination and ordering.Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
limit | number | Max items to return |
after | string | Cursor for forward pagination |
before | string | Cursor for backward pagination |
orderBy | 'createdAt' | 'proposalCount' | 'name' | Sort field |
orderDirection | 'asc' | 'desc' | Sort direction |
Response Schema
Response Schema
useDAO
Fetch a single DAO by ID.Response Schema
Response Schema
DAO type.useDAOsByManager
Fetch DAOs managed by a specific address.Proposal Hooks
useProposals
Fetch proposals with optional filters.Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
limit | number | Max items to return |
daoId | string | Filter by DAO ID |
state | ProposalState | Filter by proposal state |
proposer | string | Filter by proposer address |
orderBy | 'createdAt' | 'voteEnd' | 'voteStart' | Sort field |
orderDirection | 'asc' | 'desc' | Sort direction |
useProposal
Fetch a single proposal by ID.useProposalsByDAO
Fetch proposals for a specific DAO.useActiveProposals
Fetch all currently active proposals across all DAOs.Vote Hooks
useVotes
Fetch votes with optional filters.Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
proposalId | string | Filter by proposal ID |
daoId | string | Filter by DAO ID |
voter | string | Filter by voter address |
support | 'FOR' | 'AGAINST' | 'ABSTAIN' | Filter by vote type |
orderBy | 'createdAt' | 'weight' | Sort field |
useVotesByProposal
Fetch all votes for a specific proposal.useVotesByVoter
Fetch all votes cast by a specific address.Delegate Hooks
useDelegates
Fetch delegation records with optional filters.useDelegatesByDAO
Fetch delegates for a specific DAO.useDelegationsFrom / useDelegationsTo
Fetch delegations from or to a specific address.Token Holder Hooks
useTokenHolders
Fetch token holders with optional filters.useTokenHoldersByDAO
Fetch token holders for a specific DAO.useTokenHoldingsByAddress
Fetch all token holdings for a specific address across all DAOs.Query Keys
Each hook exports query keys for cache invalidation with TanStack Query:Available Query Keys
| Export | Keys |
|---|---|
daoKeys | .all, .lists(), .list(params), .byManager(params), .details(), .detail(id) |
proposalKeys | .all, .lists(), .list(params), .byDAO(daoId), .active(params), .details(), .detail(id) |
voteKeys | .all, .lists(), .list(params), .byProposal(id), .byVoter(voter), .details(), .detail(id) |
delegateKeys | .all, .lists(), .byDAO(daoId), .delegationsFrom(addr), .delegationsTo(addr), .details(), .detail(id) |
tokenHolderKeys | .all, .lists(), .byDAO(daoId), .byAddress(addr), .details(), .detail(id) |