Skip to content
feliramiPublic

About

Claim site for the Hypersnap $SNAP bridge on Ethereum (WalletConnect + Farcaster Mini App)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SNAP Claim

A claim site for the Hypersnap bridge ($SNAP token on Ethereum, contract 0x49B5a631F54927c0007232844f06FE18cbf69786). Built with Next.js 16 App Router, wagmi v2, viem, Reown AppKit (WalletConnect successor) and a Neynar-backed Farcaster lookup. Doubles as a Farcaster Mini App.

Stack

  • Next.js 16 + Tailwind v4 + shadcn/ui
  • wagmi 2 / viem 2
  • Reown AppKit (@reown/appkit + @reown/appkit-adapter-wagmi) for the WalletConnect modal and injected-wallet detection
  • @farcaster/miniapp-sdk + @farcaster/miniapp-wagmi-connector for in-Farcaster auto-connect
  • @neynar/nodejs-sdk (server-only) for Farcaster identity lookups by Ethereum address

Setup

cp .env.example .env.local
# fill in NEXT_PUBLIC_REOWN_PROJECT_ID and NEYNAR_API_KEY at minimum
pnpm install
pnpm dev

Open http://localhost:3000.

Required env

Var Where Required
NEXT_PUBLIC_REOWN_PROJECT_ID https://cloud.reown.com yes (for the modal to work)
NEYNAR_API_KEY https://neynar.com optional (Farcaster badge hides without it)
CLAIM_API_URL upstream Hypersnap claim service required to enable claiming
CLAIM_API_KEY upstream auth, if any optional
NEXT_PUBLIC_RPC_URL any Ethereum RPC optional
NEXT_PUBLIC_SITE_URL base URL for OG/Mini App manifest optional on Vercel
FARCASTER_ACCOUNT_ASSOCIATION Mini App account proof JSON optional, set after prod deploy

Claim payload caveat

The on-chain claim function is not a standard merkle airdrop — it is a bridge release that requires a server-signed payload from Hypersnap:

function claim(
  uint64 blockNumber,
  bytes32 merkleRoot,
  bytes ownerSig,         // signed by contract owner
  bytes32 lockId,
  address recipient,
  uint256 amount,
  uint32 destinationChainId,
  bytes32[] merkleProof
) external

A frontend cannot generate ownerSig. This site proxies that payload from an upstream service via app/api/claim-payload/route.ts. Set CLAIM_API_URL to that upstream and adjust the field mapping in the normalize() function once the real response shape is known.

Until CLAIM_API_URL is set, the UI loads, wallet connection works, the $SNAP balance and Farcaster badge render, and the claim section politely shows "claim service not configured".

Deploy to Vercel

pnpm dlx vercel link
pnpm dlx vercel env add NEXT_PUBLIC_REOWN_PROJECT_ID
pnpm dlx vercel env add NEYNAR_API_KEY
pnpm dlx vercel env add CLAIM_API_URL    # placeholder OK
pnpm dlx vercel              # preview
pnpm dlx vercel --prod       # production

Tip: upgrade your Vercel CLI first: pnpm add -g vercel@latest.

Mini App

The site exposes /.well-known/farcaster.json so Warpcast and other Farcaster clients can render it as a Mini App. The Providers wrapper detects the Mini App context on mount, auto-connects via the Farcaster wallet connector, and calls sdk.actions.ready() to dismiss the splash.

After the first production deploy, generate an accountAssociation proof at https://farcaster.xyz/~/developers/mini-apps/manifest and set FARCASTER_ACCOUNT_ASSOCIATION to the resulting JSON object.

About

Claim site for the Hypersnap $SNAP bridge on Ethereum (WalletConnect + Farcaster Mini App)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages