Farcaster users can connect their FID (Farcaster ID) with an Ethereum or Solana address. This guide demonstrates how to get information about a user given their address.Check out this Getting started guide to learn how to set up your environment and get an API key.First, initialize the client:
Copy
Ask AI
// npm i @neynar/nodejs-sdkimport { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk";// make sure to set your NEYNAR_API_KEY .env// don't have an API key yet? get one at neynar.comconst config = new Configuration({ apiKey: process.env.NEYNAR_API_KEY,});const client = new NeynarAPIClient(config);
To get vitalik.eth’s Farcaster profile:
Copy
Ask AI
// vitalik.ethconst addr = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";const user = await client.fetchBulkUsersByEthOrSolAddress({addresses: [addr]});console.log(user);