-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import neynarClient from "../helpers/neynarClient.js"; | ||
|
||
const baseAttestationScan = 'https://base.easscan.org/attestation/view/'; | ||
|
||
const replyAttestation = async (req: Request) => { | ||
if (!process.env.SIGNER_UUID) { | ||
throw new Error("Make sure you set SIGNER_UUID in your .env file"); | ||
} | ||
const body = await req.text(); | ||
const data = JSON.parse(body); | ||
const { attestationHash, praiseHash } = data; | ||
if (!attestationHash || !praiseHash) { | ||
throw new Error("attestationHash and praiseHash are required"); | ||
} | ||
await neynarClient.publishCast( | ||
process.env.SIGNER_UUID, | ||
`Thanks for using Praise and spreading gratitude and thankfulness! | ||
This is the attestation URL you just minted: | ||
${baseAttestationScan + attestationHash}`, | ||
{ | ||
replyTo: praiseHash, | ||
} | ||
); | ||
console.log("Replied with Attestation URL!"); | ||
return new Response('Attestation URL sent!', { status: 200 }); | ||
} | ||
|
||
export default replyAttestation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters