generated from blockmatic-icebox/powerstack
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0b572e
commit b1fe656
Showing
9 changed files
with
191 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
Oops, something went wrong.