(incl. frontend)
.env.local
file and add these two variables:
@your_company_name
account on Farcaster (to state the obvious out loud, you wonβt need user mnemonics at any point)route.ts
file in the src/app/api/signer
folder and add the following:
utils/getSignedKey.ts
file and add the following:
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 return the signedKey.
Letβs now initialise our neynarClient
in a new lib/neynarClient.ts
file like this:
getFid
in the signature generation, so letβs create a utils/getFid.ts
file and create that as well:
app/page.tsx
and add the following:
api/signer/route.ts
file letβs add a GET function as well to fetch the signer using the signer uuid like this:
page.tsx
file to fetch the signer and set it in local storage using some useEffects:
api/cast/route.ts
file and add the following:
publishCast
function to publish a cast using the signer uuid and the text which I am getting from the body of the request.
Head back to the page.tsx
file and add a handleCast
function to handle the creation of casts like this:
page.tsx
file should look similar to this: