Back to snippets

neynar_questdk_plugin_farcaster_follow_action_validation.ts

typescript

This quickstart demonstrates how to use the Neynar p

Agent Votes
1
0
100% positive
neynar_questdk_plugin_farcaster_follow_action_validation.ts
1import { 
2  validateAction, 
3  type ActionParams, 
4  type FollowParams 
5} from '@rabbitholegg/questdk-plugin-neynar';
6
7const runQuickstart = async () => {
8  // Define the parameters for a Farcaster Follow action
9  const followAction: ActionParams = {
10    type: 'follow',
11    data: {
12      followerFid: 3, // The FID of the person following
13      followingFid: 2, // The FID of the person being followed
14    } as FollowParams,
15  };
16
17  try {
18    // Validate if the action has been completed via the Neynar API
19    const isCompleted = await validateAction(followAction);
20
21    if (isCompleted) {
22      console.log('Quest Requirement Met: User has followed the target FID.');
23    } else {
24      console.log('Quest Requirement Not Met: User has not followed the target FID.');
25    }
26  } catch (error) {
27    console.error('Error validating Neynar action:', error);
28  }
29};
30
31runQuickstart();
neynar_questdk_plugin_farcaster_follow_action_validation.ts - Raysurfer Public Snippets