Skip to content

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:

Utility Hooks

Helper hooks:

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>
  )
}