Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions api/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ async function handleEligibility(req, res) {
const ip = req.headers['x-forwarded-for'] || req.headers['x-real-ip'] || 'unknown';
if (!rateOk(ip + ':eligibility', 20)) return res.status(429).json({ error: 'Too many requests. Try again in 1 minute.' });

const rawAddr = (req.query || {}).address;
const rawBtc = (req.query || {}).btc;
const query = req.query || {};
const rawAddr = query.address || query.stxAddress;
const rawBtc = query.btc;
if (!rawAddr || typeof rawAddr !== 'string') return res.status(400).json({ error: 'Missing ?address= parameter' });
if (!/^S[PMTN][A-Z0-9]{38,41}$/.test(rawAddr)) return res.status(400).json({ error: 'Invalid Stacks address format' });

Expand Down Expand Up @@ -365,7 +366,7 @@ module.exports = async function handler(req, res) {

if (path.endsWith('/genesis')) return handleGenesis(req, res);
if (path.endsWith('/holder')) return handleHolder(req, res);
if (path.endsWith('/eligibility')) return handleEligibility(req, res);
if (path.endsWith('/eligibility') || path.endsWith('/check')) return handleEligibility(req, res);
if (path.endsWith('/recent-mints')) return handleRecentMints(req, res);

return res.status(404).json({ error: 'Not found' });
Expand Down
4 changes: 4 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
"src": "/api/attest",
"dest": "/api/attest.js"
},
{
"src": "/api/check",
"dest": "/api/verify.js"
},
{
"src": "/api/eligibility",
"dest": "/api/verify.js"
Expand Down