From 0773972d40c7d3e9122eb9325e95fc3b7feaf629 Mon Sep 17 00:00:00 2001 From: Varun Dhananjaya Date: Wed, 11 Sep 2024 19:43:27 +0200 Subject: [PATCH] [lib] fetchLedFarcasterChannels method Summary: similar to fetchFollowedFarcasterChannels, except we filter out channels that the user does not lead Depends on D13293 Test Plan: https://gist.github.com/vdhanan/fdc48cf3a29f0394ec5646f7c728cefa confirmed that the new method returned all the channels led by that user and that the existing method returned the same results as before Reviewers: ashoat Reviewed By: ashoat Subscribers: tomek Differential Revision: https://phab.comm.dev/D13295 --- lib/types/farcaster-types.js | 4 ++++ lib/utils/neynar-client.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/lib/types/farcaster-types.js b/lib/types/farcaster-types.js index 269364941c..2ec9e1dac9 100644 --- a/lib/types/farcaster-types.js +++ b/lib/types/farcaster-types.js @@ -33,5 +33,9 @@ export type NeynarChannel = { +id: string, +name: string, +follower_count: number, + +lead: { + +fid: number, + ... + }, ... }; diff --git a/lib/utils/neynar-client.js b/lib/utils/neynar-client.js index eb4b877c8f..1f9207dbe7 100644 --- a/lib/utils/neynar-client.js +++ b/lib/utils/neynar-client.js @@ -169,6 +169,13 @@ class NeynarClient { return this.fetchFollowedFarcasterChannelsWithFilter(fid, () => true); } + fetchLedFarcasterChannels(fid: string): Promise { + return this.fetchFollowedFarcasterChannelsWithFilter( + fid, + channel => channel.lead.fid === parseInt(fid), + ); + } + async fetchFarcasterChannelByName( channelName: string, ): Promise {