Page MenuHomePhabricator

D13979.id45903.diff
No OneTemporary

D13979.id45903.diff

diff --git a/lib/utils/neynar-client.js b/lib/utils/neynar-client.js
--- a/lib/utils/neynar-client.js
+++ b/lib/utils/neynar-client.js
@@ -151,10 +151,10 @@
async fetchFarcasterChannelByID(channelID: string): Promise<?NeynarChannel> {
const params: { [string]: string } = {
- q: channelID,
+ id: channelID,
};
- const url = getNeynarURL('2', 'channel/search', params);
+ const url = getNeynarURL('2', 'channel', params);
try {
const response = await fetch(url, {
@@ -165,19 +165,12 @@
},
});
- const json: FetchFarcasterChannelsResponse = await response.json();
- const { channels } = json;
-
- for (const channel of channels) {
- if (channel.id.toLowerCase() === channelID.toLowerCase()) {
- return channel;
- }
- }
+ const json: FetchFarcasterChannelInfoResponse = await response.json();
- return null;
+ return json.channel;
} catch (error) {
console.log(
- `Failed to search Farcaster channel by ID:`,
+ 'Failed to fetch Farcaster channel info:',
getMessageForException(error) ?? 'unknown',
);
throw error;
@@ -271,39 +264,6 @@
return farcasterChannels;
}
- async fetchFarcasterChannelInfo(
- channelID: string,
- viewerFID: string,
- ): Promise<NeynarChannel> {
- const params: { [string]: string } = {
- id: channelID,
- type: 'id',
- viewer_fid: viewerFID,
- };
-
- const url = getNeynarURL('2', 'channel', params);
-
- try {
- const response = await fetch(url, {
- method: 'GET',
- headers: {
- Accept: 'application/json',
- api_key: this.apiKey,
- },
- });
-
- const json: FetchFarcasterChannelInfoResponse = await response.json();
-
- return json.channel;
- } catch (error) {
- console.log(
- 'Failed to fetch Farcaster channel info:',
- getMessageForException(error) ?? 'unknown',
- );
- throw error;
- }
- }
-
async checkIfCurrentUserFIDIsValid(fid: string): Promise<boolean> {
const url = getNeynarURL('2', 'user/bulk', { fids: fid });

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 8:17 AM (7 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2555277
Default Alt Text
D13979.id45903.diff (2 KB)

Event Timeline