Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32167733
D13979.1765053717.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13979.1765053717.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 8:41 PM (9 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840716
Default Alt Text
D13979.1765053717.diff (2 KB)
Attached To
Mode
D13979: [lib] Use channel instead of channel/search Neynar endpoint
Attached
Detach File
Event Timeline
Log In to Comment