Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33373490
D13784.1768955665.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D13784.1768955665.diff
View Options
diff --git a/lib/types/farcaster-types.js b/lib/types/farcaster-types.js
--- a/lib/types/farcaster-types.js
+++ b/lib/types/farcaster-types.js
@@ -84,3 +84,8 @@
+data: NeynarWebhookCastCreatedData,
...
};
+
+export type NeynarPostCastResponse = {
+ +success: boolean,
+ ...
+};
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
@@ -7,6 +7,7 @@
NeynarChannel,
NeynarUser,
NeynarCast,
+ NeynarPostCastResponse,
} from '../types/farcaster-types.js';
type FetchRelevantFollowersResponse = {
@@ -357,6 +358,38 @@
throw error;
}
}
+
+ async postCast(
+ signerUUID: string,
+ parent: string,
+ text: string,
+ ): Promise<NeynarPostCastResponse> {
+ const url = getNeynarURL('2', 'cast', {});
+ const body = {
+ signer_uuid: signerUUID,
+ parent,
+ text,
+ };
+ try {
+ const response = await fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'api_key': this.apiKey,
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(body),
+ });
+
+ return await response.json();
+ } catch (error) {
+ console.log(
+ 'Failed to post Farcaster cast:',
+ getMessageForException(error) ?? 'unknown',
+ );
+ throw error;
+ }
+ }
}
export { NeynarClient };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 21, 12:34 AM (15 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5952183
Default Alt Text
D13784.1768955665.diff (1 KB)
Attached To
Mode
D13784: [lib] add post cast to neynar client
Attached
Detach File
Event Timeline
Log In to Comment