Client Hooks
Complete reference for all React hooks provided by Levr SDK.
Categories
Query Hooks
Read-only data access hooks:
- useProject - Project data (static + dynamic: token, contracts, pool, treasury, staking stats, governance stats, pricing)
- useProjects - List of all registered projects
- useUser - User data (balances, staking, voting power)
- usePool - Pool state (liquidity, price, fees)
- useProposals - Governance proposals with vote receipts
- useProposal - Single proposal by ID
- useAirdropStatus - Multi-recipient airdrop status (from context)
- useVault - Vault allocation status with vesting info
- useFactory - Factory configuration (governance parameters)
Mutation Hooks
Hooks with both queries and mutations:
- useStake - Staking operations (approve, stake, unstake, claim, accrue)
- useSwap - Swap operations with quotes
- useGovernance - Governance operations (propose, vote, execute, airdrop)
- useFeeReceivers - Fee receiver management
- useConfigureSplits - Configure fee splitting among multiple recipients
- useVaultClaim - Claim vaulted tokens
- useDeploy - Deploy and register Clanker tokens
- usePrepare - Prepare contracts for deployment
- useRegister - Register existing tokens
Utility Hooks
Helper hooks:
- useSetClankerToken - Update global token
- useLevrRefetch - Manual refetch control
- useClanker - Clanker SDK instance
- useGovernanceCycle - Manage governance cycle selection
Quick Example
typescript
import { useProject, useUser, useStake } from 'levr-sdk/client'
function Component() {
const { data: project } = useProject()
const { data: user } = useUser()
const { stake } = useStake()
return (
<div>
<h1>{project?.token.name}</h1>
<p>Balance: {user?.balances.token.formatted}</p>
<p>Staked: {user?.staking.stakedBalance.formatted}</p>
<p>Voting Power: {user?.votingPower} Token Days</p>
<button onClick={() => stake.mutate(1000)}>Stake</button>
</div>
)
}