Skip to content

Commit 1ec4cb4

Browse files
committed
Merge branch 'dev'
2 parents 72404b5 + d480f4c commit 1ec4cb4

File tree

18 files changed

+1561
-7
lines changed

18 files changed

+1561
-7
lines changed

CLAUDE.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ Devnet SOL marketplace. Users buy devnet SOL with mainnet USDC or sell devnet SO
77
- **Runtime**: Node.js + TypeScript (ESM)
88
- **Framework**: Hono + @hono/node-server
99
- **Solana**: @solana/kit, @solana-program/system, @solana-program/token, @solana-program/memo
10-
- **DB**: better-sqlite3 (file-based, single table `transactions`)
10+
- **DB**: better-sqlite3 (file-based, `transactions` + `feedback`/`feedback_votes` tables)
1111
- **Logging**: pino (structured JSON logging)
12-
- **Testing**: Vitest (17 test files, 120 tests)
12+
- **Testing**: Vitest (19 test files, 137 tests)
13+
- **Frontend**: React 19 + Vite 7 + Tailwind 4 + @solana/wallet-adapter
1314
- **Package Manager**: pnpm
1415

1516
## Commands
@@ -33,6 +34,9 @@ pnpm exec tsc --noEmit # type-check without emitting
3334
| GET | `/tx/:id` | Transaction status lookup |
3435
| POST | `/buy` | Create buy order (returns USDC deposit instructions) |
3536
| POST | `/sell` | Create sell order (returns devnet SOL deposit instructions) |
37+
| GET | `/feedback` | List all feedback, sorted by votes desc |
38+
| POST | `/feedback` | Submit feedback (content, optional author) |
39+
| POST | `/feedback/:id/vote` | Upvote feedback (IP-deduplicated) |
3640

3741
## Architecture
3842

@@ -51,6 +55,7 @@ src/
5155
price.ts # GET /price — buy/sell quotes
5256
treasury.ts # GET /treasury, GET /health/detail
5357
tx.ts # GET /tx/:id — transaction status lookup
58+
feedback.ts # GET/POST /feedback, POST /feedback/:id/vote
5459
services/
5560
treasury.ts # Devnet SOL transfers (sendSol, getBalance)
5661
payout.ts # Mainnet USDC payouts (sendUsdc, canAffordPayout) with retry
@@ -59,6 +64,7 @@ src/
5964
buy-deposit.ts # Polls mainnet for incoming USDC deposits (buy flow), matches by memo + verifies amount
6065
db/
6166
sqlite.ts # TransactionDB — CRUD, atomicComplete/Buy, findPendingSells/Buys, expireStale, findFailedSellsWithDeposit
67+
feedback.ts # FeedbackDB — feedback + votes (IP-hash dedup, rate limiting)
6268
scripts/
6369
buy-e2e.ts # Buy flow E2E test (mainnet USDC → devnet SOL)
6470
sell-e2e.ts # Sell flow E2E test (devnet SOL → mainnet USDC)
@@ -87,6 +93,8 @@ scripts/
8793
- Detectors record deposit signature (devnet_tx/mainnet_tx) even on failure, enabling auto-refund
8894
- Low balance alerts log errors when treasury SOL < 10 or payout USDC < 10
8995
- Structured logging via pino (set `LOG_LEVEL` env var to control verbosity)
96+
- Feedback system: 3 posts/hour per IP, 10 votes/hour per IP, IP-hash dedup (SHA-256 truncated to 16 hex), content 10-500 chars
97+
- Frontend feedback shows optional wallet identity via `useWallet()` hook
9098

9199
## Environment Variables
92100

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# DevSOL: SEO, Feedback System & Logo
2+
3+
## Context
4+
5+
Three frontend improvements: fix generic page title for SEO, add a public feedback/voting system, and create a brand logo.
6+
7+
## Feature 1: SEO Title & Meta Tags
8+
9+
Update `frontend/index.html`:
10+
- **Title**: `DevSOL — Buy & Sell Devnet SOL`
11+
- **Description**: `Marketplace for Solana devnet SOL. Buy devnet SOL with mainnet USDC or sell devnet SOL to receive USDC. Instant, transparent, open-source.`
12+
- OG tags: `og:title`, `og:description`, `og:type=website`, `og:url`
13+
- Replace `vite.svg` favicon with DevSOL logo
14+
15+
Single-file change, no alternatives needed.
16+
17+
## Feature 2: Feedback System
18+
19+
### Storage
20+
21+
New `feedback` table in existing SQLite DB (`devsol.db`):
22+
23+
```sql
24+
CREATE TABLE feedback (
25+
id TEXT PRIMARY KEY,
26+
author TEXT, -- truncated wallet address or null (anonymous)
27+
content TEXT NOT NULL,
28+
votes INTEGER DEFAULT 0,
29+
ip_hash TEXT NOT NULL, -- SHA-256 of IP for vote deduplication
30+
created_at TEXT DEFAULT (datetime('now'))
31+
);
32+
33+
CREATE TABLE feedback_votes (
34+
feedback_id TEXT NOT NULL,
35+
ip_hash TEXT NOT NULL,
36+
PRIMARY KEY (feedback_id, ip_hash)
37+
);
38+
```
39+
40+
### Backend API
41+
42+
| Method | Path | Description |
43+
|--------|------|-------------|
44+
| GET | `/feedback` | List all feedback, sorted by votes desc |
45+
| POST | `/feedback` | Create feedback `{ content, author? }` |
46+
| POST | `/feedback/:id/vote` | Upvote (one per IP) |
47+
48+
Spam protection:
49+
- Rate limit: 3 posts/hour per IP, 10 votes/hour per IP
50+
- Content length: 10-500 chars
51+
- IP hash for vote deduplication (no double-voting)
52+
53+
### Frontend
54+
55+
New `<FeedbackSection />` component placed between TrustIndicators and Footer in App.tsx:
56+
- Submit form at top (textarea + optional wallet display if connected)
57+
- Feedback list sorted by votes (upvote button + count + content + author + timestamp)
58+
- Anonymous posting; if wallet connected, author shown as truncated address
59+
60+
### Alternatives Considered
61+
62+
- **localStorage voting**: Simpler but easy to game, lost on device switch. Rejected.
63+
- **Wallet-signed voting**: Prevents Sybil but adds friction for a devnet tool. Rejected.
64+
- **IP-based dedup (chosen)**: Good enough for devnet marketplace. Low stakes, simple.
65+
66+
## Feature 3: Logo
67+
68+
SVG icon + "DevSOL" text wordmark using brand colors (`#9945FF` purple, `#14F195` lime).
69+
70+
Usage:
71+
- Favicon (replace `vite.svg`)
72+
- Header component (replace text-only "DevSOL")
73+
- OG image reference
74+
75+
## Decisions
76+
77+
- Feedback stored in SQLite (same DB, no new infra)
78+
- Anonymous posting, optional wallet identity
79+
- IP-hash vote deduplication (no wallet signature required)
80+
- Feedback section on main page below stats
81+
- Simple upvotes only (no downvotes)

0 commit comments

Comments
 (0)