Skip to content

Commit

Permalink
feat(billboard): parse event.body
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed Mar 5, 2024
1 parent 84b845c commit 4ae0926
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions handlers/clear-auction-and-distribute-tax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@ import {
} from '../lib/billboard/index.js'
import { Slack } from '../lib/utils/slack.js'

type RequestBody = {
fromTokenId: string
toTokenId: string
merkleRoot: string
// accessToken: string // to protect this API?
}

export const handler = async (
event: APIGatewayEvent & {
fromTokenId: string
toTokenId: string
merkleRoot: string
// accessToken: string // to protect this API?
},
event: APIGatewayEvent,
context: Context
): Promise<APIGatewayProxyResult> => {
console.log(`Event: ${JSON.stringify(event, null, 2)}`)
console.log(`Context: ${JSON.stringify(context, null, 2)}`)

const slack = new Slack()
const fromTokenId = BigInt(event.fromTokenId || 0)
const toTokenId = BigInt(event.toTokenId || 0)
const merkleRoot = event.merkleRoot as `0x${string}`
const body = (event.body ? JSON.parse(event.body) : {}) as RequestBody
const fromTokenId = BigInt(body.fromTokenId || 0)
const toTokenId = BigInt(body.toTokenId || 0)
const merkleRoot = body.merkleRoot as `0x${string}`
const treeId = merkleRoot

const isInvalidTokenIds =
Expand Down

0 comments on commit 4ae0926

Please sign in to comment.