Not on Next.js? Nothing here depends on the framework except the
"use client" directive and the @/ import alias. The components work in any React app with wagmi and TanStack Query installed.Install
The Client
Create the SDK client once at module scope. It is frozen and immutable, so sharing it is safe.lib/tbi.ts
Building Against Staging
Staging runs the same API and SDK surface against test campaigns. Those campaigns track real positions on mainnet chains but pay rewards on Base Sepolia (chain84532), so you can deposit into your actual vault and claim test tokens without spending real rewards.
Ask the team in your partner channel or on Discord for the ID of the staging campaign to build against. There is no self-serve way to create one.
Providers
Wrap your app in wagmi and TanStack Query. Include every chain your campaigns pay on, plus Base Sepolia while you are on staging. The wallet has to be on the reward chain to claim and on the event chain to deposit, so both need to be in the config.app/providers.tsx
app/layout.tsx
staleTime matches how often campaign stats actually change. Polling faster only spends your rate limit. See Caching and Polling.
Formatting Helpers
Every amount the SDK returns is abigint in base units, APRs are basis points, and campaigns carry no display name. These helpers turn all of that into strings for the UI.
lib/format.ts
Persisting the Query Cache
TanStack Query’s in-memory cache handlesbigint fine. If you persist the cache to localStorage or IndexedDB, JSON.stringify throws on the first response. The serializer pair is in Data Conventions.
The Examples
Opportunities List
Live campaigns with reward APR, TVL, and time remaining.
Rewards Panel
What the connected wallet has earned and can claim.
Claim Button
Switch chain, simulate, submit, and update the UI.
Deposit Button
Route a deposit through the Forwarder when a campaign requires it.