Skip to content

Commit 903c972

Browse files
author
CloudLobster
committed
docs + fix: add ATTN/airdrop API docs, revert Wave 1 to 4/1
- Add 12 new API endpoints to /api/docs (ATTN + Airdrop) - Revert Wave 1 claimOpensAt to 2026-04-01T11:01:00Z (production) - AI agents can now discover airdrop system via API docs
1 parent 79f4a5a commit 903c972

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

worker/src/index.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,68 @@ app.get('/api/docs', (c) => {
420420
description: 'Dashboard: bonds received/sent, QAF score',
421421
},
422422

423+
// — $ATTN Tokens (v3) —
424+
'GET /api/attn/balance': {
425+
auth: 'Bearer token',
426+
description: 'Get your ATTN balance, daily earned, and claim status',
427+
response: '{ handle, balance, daily_earned, daily_earn_cap, can_claim, next_claim_in_seconds, constants }',
428+
},
429+
'POST /api/attn/claim': {
430+
auth: 'Bearer token',
431+
description: 'Claim daily ATTN drip (manual, no accumulation — miss a day, lose it)',
432+
response: '{ claimed, amount, balance, next_claim_in_seconds }',
433+
note: 'Returns claimed:false with reason if already claimed today or cap reached.',
434+
},
435+
'GET /api/attn/history': {
436+
auth: 'Bearer token',
437+
description: 'ATTN transaction history',
438+
query: '?limit=20',
439+
response: '{ transactions: [{ id, amount, type, note, created_at }] }',
440+
},
441+
'GET /api/attn/settings': {
442+
auth: 'Bearer token',
443+
description: 'Get your ATTN receive price setting',
444+
response: '{ receive_price, note }',
445+
},
446+
'PUT /api/attn/settings': {
447+
auth: 'Bearer token',
448+
description: 'Set ATTN receive price (how much senders stake to email you)',
449+
body: '{ receive_price: 1-10 }',
450+
},
451+
'POST /api/attn/buy': {
452+
auth: 'Bearer token',
453+
description: 'Purchase ATTN with USDC (on-chain verified)',
454+
body: '{ tx_hash: "0x...", amount_usdc: number }',
455+
},
456+
'GET /api/attn-price/:handle': {
457+
description: 'Check ATTN stake price for a recipient (public, no auth)',
458+
response: '{ handle, attn_enabled, cold_email_stake, reply_thread_stake }',
459+
},
460+
461+
// — Airdrop Waves —
462+
'GET /api/airdrop/waves': {
463+
auth: 'Bearer token',
464+
description: 'List all airdrop waves with your score and claim status',
465+
response: '{ waves: [{ id, name, badge, multiplier, status, score: { breakdown, base_score, total }, claim_opens_at, claimed? }] }',
466+
note: 'status: preview (locked) | claimable | claimed | expired',
467+
},
468+
'GET /api/airdrop/:waveId': {
469+
auth: 'Bearer token',
470+
description: 'Get single wave detail with your score breakdown',
471+
response: '{ id, name, status, score: { breakdown: { emails_received, emails_read, emails_replied, emails_sent, attn_staked, days_since_signup }, base_score, multiplier, total } }',
472+
},
473+
'POST /api/airdrop/:waveId/claim': {
474+
auth: 'Bearer token',
475+
description: 'Claim airdrop for a wave (only works after claim opens)',
476+
response: '{ claimed, wave, amount, score }',
477+
note: 'Wave 1 (Early Bird 🐣): 2× multiplier, opens 2026-04-01T04:01 PT. Score = received×1 + read×2 + replied×5 + sent×1 + staked×0.5 + days×2.',
478+
},
479+
'GET /api/airdrop/:waveId/leaderboard': {
480+
auth: 'Bearer token',
481+
description: 'Top 20 airdrop earners for a wave',
482+
response: '{ wave, leaderboard: [{ handle, amount, claimed_at }] }',
483+
},
484+
423485
// — Public —
424486
'GET /api/identity/:address': {
425487
description: 'Look up email for any wallet (public, no auth)',

worker/src/routes/airdrop.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const WAVE_1: WaveConfig = {
5353
description: 'Reward early adopters who used BaseMail before April 1, 2026. 2× multiplier!',
5454
multiplier: 2,
5555
snapshotCutoff: Math.floor(new Date('2026-04-01T11:01:00Z').getTime() / 1000),
56-
// TEST MODE: temporarily set to past for testing. Revert to: Math.floor(new Date('2026-04-01T11:01:00Z').getTime() / 1000)
57-
claimOpensAt: Math.floor(new Date('2026-01-01T00:00:00Z').getTime() / 1000),
56+
claimOpensAt: Math.floor(new Date('2026-04-01T11:01:00Z').getTime() / 1000),
5857
claimClosesAt: 0, // never expires
5958
scoring: {
6059
email_received: 1,

0 commit comments

Comments
 (0)