Skip to content

Commit

Permalink
feat: added commas
Browse files Browse the repository at this point in the history
  • Loading branch information
mrisqid committed Aug 10, 2024
1 parent d8198c5 commit f81c795
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions apps/haus/src/app/api/attestation/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: {
Expand Down

0 comments on commit f81c795

Please sign in to comment.