Skip to content

[T2.5f] v1 endpoint rewrites (status, leaderboard, points deprecation) #1247

Description

@realproject7

Epic: #1229 · Spec: §6.2, §8 Phase 2 (T2.5f) · Type: CODE · Estimate: 0.5 day · Depends on: T2.4b (#1241)

Scope

(a) src/app/api/airdrop/status/route.ts

  • Update FDV / milestone fields to v5 thresholds (Bronze $100K / Silver $1M / Gold $5M / Diamond $10M)
  • Remove streak / weekly-recap surface from response
  • Add THREE fields:
    • NEW per RE1 round-11, refined round-23: env_check.all_present (boolean) — true iff all required effective runtime config + secrets are present. Validates:
      • Required env-based secrets: TWITTERAPI_IO_KEY, NEYNAR_API_KEY, SUPABASE_SERVICE_ROLE_KEY, CRON_SECRET (always env vars)
      • Required runtime config fields (per T2.1's resolved getAirdropConfig()): SIWE_DOMAIN, SIWE_URI, SIWE_STATEMENT, SIWE_CHAIN_ID, PLOTLINK_X_HANDLE, PLOTLINK_FC_FID. These may be code constants OR env vars depending on T2.1 implementation — check the effective value, not the env var source.
      • Required campaign fields: POOL_AMOUNT > 0, CAMPAIGN_START < CAMPAIGN_END, all 4 MILESTONES defined.
      • Returns true only if ALL above resolve to non-null/valid values.
      • Do NOT expose individual values; only the aggregate boolean. Consumed by T4.0 ([T4.0] Deploy gate automation scripts (T2.x, T3.x, Pre-T4.1) #1268) pre-T4.1 staging-ready check.
    • activation_count = raw SELECT COUNT(*) FROM pl_activations WHERE activated_at IS NOT NULL (marketing/growth narrative on hero strip)
    • eligible_activation_count = additionally filtered by is_blacklisted = FALSE (matches T2.4b helper's eligibility; distribution accounting)
  • When T0.1 picks "skip blacklist", the two activation counts are identical

(b) src/app/api/airdrop/leaderboard/route.ts

  • Rewrite ranking to v5 by consuming the T2.4b shared helper (whichever form T2.4b chose — option A SQL fragment OR option B view; this ticket is helper-agnostic).
  • Expected use: call the helper to get all activated, non-blacklisted wallets with their weighted_spend, then ORDER BY weighted_spend DESC LIMIT N in the consuming code.
  • Do NOT hardcode SELECT * FROM v_weighted_spend — that assumes option B. Reference the T2.4b helper export by name (e.g., weightedSpendQuery(config) from lib/airdrop/sql.ts if option A; or SELECT * FROM v_weighted_spend if option B).
  • Used by optional /airdrop/leaderboard subpage
  • If endpoint accepts { message, signature }, also migrate auth to siwe-verify.ts here (T2.5e scope catches this if missed)

(c) src/app/api/airdrop/points/route.ts

  • DEPRECATE to thin compat shim: return { address, buy_volume_plot, fetched_at }
  • Add headers: Deprecation: true + Link: </api/airdrop/projection>; rel="successor-version"
  • OR delete the route file entirely if no internal callers remain — confirm via grep -r "/api/airdrop/points" src before deciding

(d) src/app/api/airdrop/referral-code/route.ts — DO NOT TOUCH GET (RE1 round-12)

The GET handler (line 14-37) returns {code, is_farcaster_username} without auth and is consumed by src/hooks/useReferralCode.tssrc/components/ShareButtons.tsx:15 on every story page. No shape change, no auth change to GET. POST migration handled by T2.5e (#1246). If this ticket touches the route file at all, only for the leaderboard cross-audit (no edits expected).

Acceptance

  • /status returns v5 milestones + env_check.all_present + activation_count + eligible_activation_count
  • /leaderboard consumes the T2.4b helper (whichever option A or B was chosen) — no hardcoded view assumption in PR
  • /points either returns deprecation shim with headers OR is removed (PR notes which)
  • /referral-code GET shape preserved (verified by curl on staging post-deploy)
  • No verifyWalletOwnership usage remains in any of the modified files

Dependencies

T2.4b (shared helper, whichever form chosen)

Metadata

Metadata

Assignees

No one assigned

    Labels

    airdropPLOT 10x Airdrop Campaign

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions