Skip to main content
Short snippets that build on the full examples. Each one reuses the client and helpers from Project Setup and links to the guide that explains the endpoints behind it.

Campaign Status Line

One string for the state of a campaign, for a badge subtitle, a table cell, or a tooltip. Pass the wallet’s claimable amount when you have it, so a finished campaign with unclaimed rewards says so.
lib/campaign-status.ts
claimable comes from userPosition.claimable, claims.statuses, or rewards.forUser. Status alone never decides claimability: an ended or finalized campaign can still have rewards waiting. See Lifecycle and Claimability.

Open-Ended Runway

Open-ended campaigns pay a fixed amount per second until their budget runs out, so “time left” is a projection. This shows the daily emission and how long it is funded for.
lib/runway.ts
fundedUntil is a floor: it assumes the full emission rate, and an APY cap or quiet periods only make the budget last longer. Top-ups push it out without changing the rate.

Per-Campaign Earnings

The Rewards Panel lists every campaign. When a page is about one campaign, select it out of the same query, so the two views share a cache entry.
hooks/use-campaign-earnings.ts
null means the wallet has not entered the campaign. Otherwise accumulatedRewards is what it has earned, and claimable is what it can claim now. Why those two differ is in How Claiming Works.

Referral Bind Before Deposit

For campaigns with a referral pool: bind the referee to the referrer from your link right before they sign their first deposit. Never let it block the deposit.
lib/referral-bind.ts
Call it in your deposit handler before sending the deposit transaction. It costs the user one signature and no gas. Two things to know before you add it:
  • Both wallets need Rabbithole accounts. A referee without a linked Rabbithole wallet is rejected with WALLET_NOT_LINKED, which for many partner users will be the common case.
  • Username links need resolving first. The Add Referrals guide has resolveReferrer() for that, and the full list of rejection codes.

Forwarder Deposit

Only campaigns with requiresForwarderDeposit: true need this. They reward positions that entered through the Rabbithole Forwarder, and discovery hides them unless you pass includeForwarderRequired: true. If you run a campaign on your own vault and users deposit through your own frontend, you do not need it. The short version:
Deposits happen on the event chain, where the vault is, not the reward chain. A complete React component, with the chain switch, target lookup, and multi-asset handling, is in Forwarder Deposits.

Keep Exploring

Reward Badge

The status line and earnings, assembled for a vault page.

Rewards Panel

Every campaign the wallet has earned in.

Add Referrals

The full referral flow, from link to payout.