feat: working farcaster client with neynar#570
Conversation
|
Thanks! Neynar is The Way. |
|
can you include #386 so it adds my commits too |
| # Farcaster Neynar Configuration | ||
| FARCASTER_FID= | ||
| FARCASTER_NEYNAR_SIGNER_UUID= | ||
| FARCASTER_NEYNAR_API_KEY= No newline at end of file |
There was a problem hiding this comment.
@sayangel Add comments for the newly added environment variables (FARCASTER_FID, FARCASTER_NEYNAR_SIGNER_UUID, FARCASTER_NEYNAR_API_KEY) to explain what each variable is used for and any format restrictions. This will help developers understand how to set up these configurations correctly.
There was a problem hiding this comment.
btw does neynar signer uuid is the client id?
| "@ai16z/client-auto": "workspace:*", | ||
| "@ai16z/client-direct": "workspace:*", | ||
| "@ai16z/client-discord": "workspace:*", | ||
| "@ai16z/client-farcaster": "workspace:*", |
There was a problem hiding this comment.
@sayangel Ensure that you review and update the documentation to reflect this new dependency.
| @@ -0,0 +1,19 @@ | |||
| { | |||
| "name": "@ai16z/client-farcaster", | |||
| "version": "0.0.1", | |||
There was a problem hiding this comment.
@sayangel Review the new package’s version (0.0.1). Consider versioning best practices see semver.org
| }, | ||
| "scripts": { | ||
| "build": "tsup --format esm --dts", | ||
| "dev": "tsup --watch" |
There was a problem hiding this comment.
@sayangel add both the lint and test scripts, refer to other packages to get more details about their implementations.
| async stop() { | ||
| await Promise.all([this.posts.stop(), this.interactions.stop()]); | ||
| } | ||
| } |
There was a problem hiding this comment.
@sayangel Ensure the new client-farcaster package is covered by tests, including unit tests and integration tests, to verify its functionality.
| async stop() { | ||
| await Promise.all([this.posts.stop(), this.interactions.stop()]); | ||
| } | ||
| } |
There was a problem hiding this comment.
@sayangel Update or add relevant documentation, such as the README, with information on the new package and environment variables.
Ensure to add any documentation for developers on how to configure the newly added @ai16z/client-farcaster and related environment variables.
mcp97
left a comment
There was a problem hiding this comment.
LGTM added some nits but overall amazing work! Please add a screengrab of successful run if you can thanks so much! Amazing work!
| } | ||
| } catch (err) { | ||
| if (isApiErrorResponse(err)) { | ||
| console.log(err.response.data); |
There was a problem hiding this comment.
let's use elizaLogger everywhere before throwing and not console log please thanks :)
| }); | ||
| const cast = { | ||
| hash: response.cast.hash, | ||
| //parentHash: cast.parent_hash, |
| fid: request.fid, | ||
| limit: request.pageSize, | ||
| }); | ||
| //console.log(response); |
| }); | ||
| const result = await this.neynar.fetchBulkUsers({ fids: [fid] }); | ||
| if (!result.users || result.users.length < 1) { | ||
| console.log("getUserDataByFid ERROR"); |
| return { | ||
| timeline, | ||
| nextPageToken: results.nextPageToken, | ||
| //TODO implement paging |
There was a problem hiding this comment.
can we add an issue for this and reference it here
|
|
||
| if (!memory.content.text) { | ||
| console.log("skipping cast with no text", cast.id); | ||
| console.log("skipping cast with no text", cast.hash); |
| if (!response.text) return; | ||
|
|
||
| try { | ||
| console.log(`Replying to cast ${cast.hash}.`); |
| // const farcasterUserName = | ||
| // this.runtime.getSetting("FARCASTER_USERNAME")!; | ||
|
|
| client: this.client, | ||
| runtime: this.runtime, | ||
| signer: this.signer, | ||
| //: this.signer, |
| roomId | ||
| ); | ||
|
|
||
| console.log( |
Relates to:
Farcaster client: #300
Modification of open PR: #386
Risks
Low
Background
What does this PR do?
Adds a farcaster-client package so that Eliza agents can post to Farcaster. This PR modifies an existing Farcaster client PR to use Neynar instead of a direct hub. This makes it easier for people to deploy hubs and makes it easier to add additional features in the future using Neynar's APIs for interacting with Farcaster data.
What kind of change is this?
Features (non-breaking change which adds functionality)
Documentation changes needed?
Needs documentation on how to create a signer that can submit messages to Farcaster (via Neynar).
Testing
I have tested this PR by running a local eliza agent that is making posts on Farcaster via the Yoinker account: https://warpcast.com/yoinker
All the accounts in this cast have been created by a local Eliza instance.
Where should a reviewer start?
Detailed testing steps