Write to Farcaster protocol and let Neynar manage your signers for you
npm
, yarn
, etc.):
.env.local
file in your Next.js project root and add:
@your_company_name
account on Farcaster (to state the obvious out loud, you won’t need user mnemonics at any point)lib/neynarClient.ts
lib/neynarClient.ts
utils/getFid.ts
utils/getFid.ts
utils/getSignedKey.ts
utils/getSignedKey.ts
createSigner
to create a signer, and then we use the appAccountKey.signKeyRequest
function from the @farcaster/hub-nodejs
package to create a sign key request. Finally, we use the registerSignedKey
function from the neynarClient to register the signedKey. registerSignedKey
returns signer_approved_url
that needs to be handled (More on this in step 7)
app/api/signer/route.ts
app/api/signer/route.ts
app/api/cast/route.ts
app/api/cast/route.ts
.env.local
file is correctly set up before running the application.
/api/signer
signer_uuid
in the database or use fetchSigners api to fetch signers for the user (We recommend the latter method)
Convert signer_approved_url
to a QR code (For testing, you can use any online tool, e.g., QRFY)
If the user is using the application on desktop, then ask the user to scan this QR code. If the user is on mobile, ask them to click the link. This will deeplink the user into Warpcast, and they will see the following screenshot.
/api/cast
@your_company_name
account)