Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3508885
D13979.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13979.id.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
Sun, Dec 22, 12:15 AM (2 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2689763
Default Alt Text
D13979.id.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