This file contains hidden or 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
"txn": async function(req) { | |
return new Promise(async function(resolve, reject) { | |
var frame = {}; | |
frame.id = req.params.id; | |
frame.square = true; | |
frame.postUrl = `https://frm.lol/frames/${req.params.id}`; | |
const frameResult = await util.validate(req); // neynar frame validation endpoint | |
if (frameResult.valid == true) { | |
if ("transactionId" in req.body.untrustedData) { | |
// transaction has completed |
This file contains hidden or 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
if (threadHash) { | |
const casts = await util.getAllCastsInThread(threadHash); // calls Neynar API to fetch all replies to a cast | |
var count = 0; | |
var regexp = /\b([0-9]+) \$degen\b/i; | |
for (var i = 0; i < casts.length; i++) { | |
//console.log("count", count); | |
var cast = casts[i]; | |
if (cast.parentHash == threadHash) { | |
var text = cast.text; | |
if (regexp.test(text)) { |