From f81c7953f52e1498523bb101706a03afa0d8ce89 Mon Sep 17 00:00:00 2001 From: mrisqid Date: Sat, 10 Aug 2024 12:35:47 +0700 Subject: [PATCH] feat: added commas --- apps/haus/src/app/api/attestation/route.ts | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/haus/src/app/api/attestation/route.ts b/apps/haus/src/app/api/attestation/route.ts index 6e47e2b..181a650 100644 --- a/apps/haus/src/app/api/attestation/route.ts +++ b/apps/haus/src/app/api/attestation/route.ts @@ -10,7 +10,16 @@ export async function POST(request: Request) { const body = await request.json() const { id, eventId, worldProof, holderName, type, seatNumber, entryFor, recipient } = body - if (!id || !eventId || !worldProof || !holderName || !type || !seatNumber || !entryFor || !recipient) { + if ( + !id || + !eventId || + !worldProof || + !holderName || + !type || + !seatNumber || + !entryFor || + !recipient + ) { return NextResponse.json({ message: 'All field are required' }, { status: 400 }) } // Initialize the sdk with the address of the EAS Schema contract address @@ -24,16 +33,18 @@ export async function POST(request: Request) { easInstance.connect(signer) // Initialize SchemaEncoder with the schema string - const schemaEncoder = new SchemaEncoder("string id,string event_id,string world_proof,string holder_name,string type,string seat_number,uint8 entry_for"); + const schemaEncoder = new SchemaEncoder( + 'string id,string event_id,string world_proof,string holder_name,string type,string seat_number,uint8 entry_for', + ) const encodedData = schemaEncoder.encodeData([ - { name: "id", value: id, type: "string" } - { name: "event_id", value: eventId, type: "string" } - { name: "world_proof", value: worldProof, type: "string" } - { name: "holder_name", value: holderName, type: "string" } - { name: "type", value: type, type: "string" } - { name: "seat_number", value: seatNumber, type: "string" } - { name: "entry_for", value: entryFor, type: "uint8" } - ]); + { name: 'id', value: id, type: 'string' }, + { name: 'event_id', value: eventId, type: 'string' }, + { name: 'world_proof', value: worldProof, type: 'string' }, + { name: 'holder_name', value: holderName, type: 'string' }, + { name: 'type', value: type, type: 'string' }, + { name: 'seat_number', value: seatNumber, type: 'string' }, + { name: 'entry_for', value: entryFor, type: 'uint8' }, + ]) const tx = await easInstance.attest({ schema: SCHEMA_UID as string, data: {