Skip to content

feat: Integrate Quidli SNS API for wallet address resolution in sidebar #685

@hellno

Description

@hellno

Summary

Integrate the Quidli Social Name Service (SNS) API to resolve Farcaster FIDs to additional ETH wallet addresses in the right sidebar's author context panel.

Background

The SNS API resolves social identities (Twitter, Discord, Telegram, Farcaster, email) to associated ETH wallet addresses. This could surface wallet addresses that users haven't explicitly verified on Farcaster but have linked via other platforms.

Current state: AuthorContextPanel.tsx displays verified_addresses.eth_addresses from Neynar API.

Proposed: Add a new "SNS Wallet" section showing addresses resolved via Quidli.

API Details

Base URL: https://api.sns.quid.li

Endpoint: POST /lookup

{
  "recipients": [
    { "type": "farcaster", "fid": "3" }
  ]
}

Response:

{
  "status": "completed",
  "results": [
    {
      "type": "farcaster",
      "fid": "3",
      "walletAddress": "0x91e547D48CF666495A8eFbBa26c65286B6af8aBf"
    }
  ]
}

Rate Limits (Important):

  • 5 requests/second
  • 20 requests/minute

Note: Some lookups may return status: "processing" with a pendingRequestId, requiring a follow-up GET /lookup/follow-up/{id} call.

Proposed Implementation

Caching Strategy

Given strict rate limits, use aggressive caching following existing patterns:

Layer Technology TTL Rationale
Server unstable_cache 7 days Wallet addresses rarely change (matches onchain data pattern)
Client React Query 24h stale, 7d gc Long-lived data

Files to Create/Modify

  1. /app/api/sns/lookup/route.ts - API route

    • Check unstable_cache first
    • Handle async processing status with polling
    • Return cached or fresh data
  2. /src/hooks/queries/useSnsWallet.ts - React Query hook

    • Debounce to avoid rapid selection changes (500ms)
    • Long stale/gc times
  3. /src/common/components/Sidebar/AuthorContextPanel.tsx - UI

    • Add "SNS Wallet" section below "Verified Addresses"
    • Show loading/resolved/not-found states
    • Copy-to-clipboard (reuse existing utility)

Architecture

AuthorContextPanel
  └─ useSnsWallet(fid) [debounced 500ms]
       └─ React Query (staleTime: 24h)
            └─ /api/sns/lookup?fid=X
                 └─ unstable_cache (7 days)
                      └─ Quidli SNS API

Future Enhancement: Request Batching

SNS API supports batch lookups. Could implement batshit pattern (like profileBatcher.ts) with 100ms window to batch FIDs from visible feed items.

Environment

Requires QUIDLI_SNS_API_KEY environment variable.

Tasks

  • Add QUIDLI_SNS_API_KEY to environment
  • Create /app/api/sns/lookup/route.ts with unstable_cache
  • Handle async processing status (polling or skip)
  • Create useSnsWallet.ts hook with debounce
  • Add SNS wallet section to AuthorContextPanel.tsx
  • Add loading/error/empty states
  • Test rate limit handling

Questions

  • Should we show SNS wallet even if it matches a verified address? (dedupe?)
  • What label? "Quidli Wallet" / "SNS Wallet" / "Linked Wallet"?
  • Auto-fetch or manual "Resolve" button?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions