Skip to content

Server API

Complete reference for server-side APIs provided by Levr SDK.

Categories

Query Functions

Core data fetching functions:

Class APIs

Class-based APIs for operations:

Swap Functions

Uniswap V3/V4 swap functionality:

  • quote - Unified quote API for V3 and V4 (read & bytecode methods)
  • swapV4() - Execute V4 swap

Utilities

Helper functions and constants:

Quick Example

typescript
import { getProject, Stake } from 'levr-sdk'
import { createPublicClient, createWalletClient, http } from 'viem'
import { base } from 'viem/chains'

const publicClient = createPublicClient({
  chain: base,
  transport: http(),
})

// Get project data
const projectData = await getProject({
  publicClient,
  clankerToken: '0x...',
})

if (!projectData) {
  throw new Error('Project not found')
}

// Use staking
const stake = new Stake({
  wallet: walletClient,
  publicClient,
  project: projectData,
})

await stake.approve(1000)
await stake.stake(1000)