Skip to content

Commit

Permalink
chore: use biome
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboesquivel committed Aug 21, 2024
1 parent a0b572e commit b1fe656
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 178 deletions.
102 changes: 51 additions & 51 deletions apps/indexer/package.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
"name": "launchpad-indexer",
"version": "0.0.1",
"description": "",
"main": "src/index.ts",
"repository": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"dev": "env-cmd ts-node-dev -r tsconfig-paths/register ./src",
"start": "env-cmd node ./dist",
"build": "rimraf dist && tsc -b",
"prod": "ts-node-dev -r tsconfig-paths/register ./src"
},
"dependencies": {
"@dfuse/client": "^0.3.21",
"@repo/supabase": "workspace:*",
"@repo/trigger": "workspace:*",
"@sentry/integrations": "^7.114.0",
"@sentry/node": "^8.19.0",
"@sentry/profiling-node": "^8.26.0",
"@supabase/supabase-js": "^2.44.4",
"@trigger.dev/sdk": "^2.3.19",
"@types/pino-http": "^5.8.4",
"app-contracts": "workspace:*",
"app-env": "workspace:*",
"app-lib": "workspace:*",
"axios": "^1.7.2",
"bn.js": "^5.2.1",
"express": "^4.19.2",
"express-rate-limit": "^7.4.0",
"helmet": "^7.1.0",
"lodash": "^4.17.21",
"node-fetch": "2.6.4",
"pino-http": "^10.2.0",
"resend": "^3.5.0",
"viem": "latest",
"ws": "^8.18.0"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/lodash": "^4.17.7",
"@types/node-fetch": " 2.6.4",
"bun-types": "latest",
"env-cmd": "^10.1.0",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"@repo/typescript-config": "workspace:*",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.4"
}
"name": "launchpad-indexer",
"version": "0.0.1",
"description": "",
"main": "src/index.ts",
"repository": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"dev": "env-cmd ts-node-dev -r tsconfig-paths/register ./src",
"start": "env-cmd node ./dist",
"build": "rimraf dist && tsc -b",
"prod": "ts-node-dev -r tsconfig-paths/register ./src"
},
"dependencies": {
"@dfuse/client": "^0.3.21",
"@repo/supabase": "workspace:*",
"@repo/trigger": "workspace:*",
"@sentry/integrations": "^7.114.0",
"@sentry/node": "^8.19.0",
"@sentry/profiling-node": "^8.26.0",
"@supabase/supabase-js": "^2.44.4",
"@trigger.dev/sdk": "^2.3.19",
"@types/pino-http": "^5.8.4",
"app-contracts": "workspace:*",
"app-env": "workspace:*",
"app-lib": "workspace:*",
"axios": "^1.7.2",
"bn.js": "^5.2.1",
"express": "^4.19.2",
"express-rate-limit": "^7.4.0",
"helmet": "^7.1.0",
"lodash": "^4.17.21",
"node-fetch": "2.6.4",
"pino-http": "^10.2.0",
"resend": "^3.5.0",
"viem": "latest",
"ws": "^8.18.0"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/lodash": "^4.17.7",
"@types/node-fetch": " 2.6.4",
"bun-types": "latest",
"env-cmd": "^10.1.0",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"@repo/typescript-config": "workspace:*",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.4"
}
}
20 changes: 9 additions & 11 deletions apps/indexer/src/routes/alchemy.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import crypto from 'crypto'
import { addressActivityTask } from '@repo/trigger'
import type { Request, Response } from 'express'
import { logger } from '~/lib/logger'
import { appConfig } from '../config'
import { addressActivityTask } from '@repo/trigger'


export function alchemyWebhook(req: Request, res: Response) {
if (!validateAlchemySignature(req))
return res.status(401).send('Unauthorized')

logger.info(req.body)

// TODO: validate user is whitelisted
// TODO: validate user is whitelisted

addressActivityTask.trigger(req.body)
addressActivityTask.trigger(req.body)

res.status(200).send('Webhook processed')
}


function validateAlchemySignature(req: Request): boolean {
const alchemySignature = req.headers['x-alchemy-signature'] as string
const payload = JSON.stringify(req.body)
const hmac = crypto.createHmac('sha256', appConfig.evm.alchemySecretKey)
hmac.update(payload)
return alchemySignature === hmac.digest('hex')
}
const alchemySignature = req.headers['x-alchemy-signature'] as string
const payload = JSON.stringify(req.body)
const hmac = crypto.createHmac('sha256', appConfig.evm.alchemySecretKey)
hmac.update(payload)
return alchemySignature === hmac.digest('hex')
}
Loading

0 comments on commit b1fe656

Please sign in to comment.