Skip to content

getFarcasterUserAddress

The getFarcasterUserAddress function retrieves the user address associated with a given Farcaster ID (fid). It provides options to specify whether the client wants custody address and/or verified addresses, and also allows the user to provide their own neynar api key.

By default, both custody and verified addresses are provided.

Usage

import { getFarcasterUserAddress } from '@coinbase/onchainkit/farcaster';
 
const userAddress = await getFarcasterUserAddress(fid, options); 

Returns

GetFarcasterUserAddressResponse

Returns the Custody Address and the list of all verified addresses of a given fid.

Parameters

fid

  • Type: string

Farcaster ID

options.neynarApiKey

  • Type: string

Default to onchain-kit's default key.

const userAddress = await getFarcasterUserAddress(fid, {
  neynarApiKey: 'MY_NEYNAR_API_KEY', 
});

options.hasCustodyAddress

  • Type: boolean

Optional options to specify if the client wants custody addresses. Default to true.

const userAddress = await getFarcasterUserAddress(fid, {
  hasCustodyAddress: false, 
});

options.hasVerifiedAddresses

  • Type: boolean

Optional options to specify if the client wants verified addresses. Default to true.

const userAddress = await getFarcasterUserAddress(fid, {
  hasVerifiedAddresses: false, 
});