From 0895c93e1134155c7e3a2c2943c53ea9fcf51046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Silva?= Date: Thu, 13 Jun 2024 23:14:17 -0300 Subject: [PATCH] Adding property allowFramegear conditionally --- app/api/frame/route.ts | 7 ++++++- app/api/tx/route.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/api/frame/route.ts b/app/api/frame/route.ts index 47701013..80f593ee 100644 --- a/app/api/frame/route.ts +++ b/app/api/frame/route.ts @@ -4,7 +4,12 @@ import { NEXT_PUBLIC_URL } from '../../config'; async function getResponse(req: NextRequest): Promise { const body: FrameRequest = await req.json(); - const { isValid, message } = await getFrameMessage(body, { neynarApiKey: 'NEYNAR_ONCHAIN_KIT' }); + const allowFramegear = process.env.NODE_ENV !== 'production'; + // Remember to replace 'NEYNAR_ONCHAIN_KIT' with your own Neynar API key + const { isValid, message } = await getFrameMessage(body, { + neynarApiKey: 'NEYNAR_ONCHAIN_KIT', + allowFramegear, + }); if (!isValid) { return new NextResponse('Message not valid', { status: 500 }); diff --git a/app/api/tx/route.ts b/app/api/tx/route.ts index a00a2726..f268322f 100644 --- a/app/api/tx/route.ts +++ b/app/api/tx/route.ts @@ -8,8 +8,12 @@ import type { FrameTransactionResponse } from '@coinbase/onchainkit/frame'; async function getResponse(req: NextRequest): Promise { const body: FrameRequest = await req.json(); + const allowFramegear = process.env.NODE_ENV !== 'production'; // Remember to replace 'NEYNAR_ONCHAIN_KIT' with your own Neynar API key - const { isValid } = await getFrameMessage(body, { neynarApiKey: 'NEYNAR_ONCHAIN_KIT' }); + const { isValid } = await getFrameMessage(body, { + neynarApiKey: 'NEYNAR_ONCHAIN_KIT', + allowFramegear, + }); if (!isValid) { return new NextResponse('Message not valid', { status: 500 });