Skip to content

Commit d480f4c

Browse files
committed
chore: integration fixes and CLAUDE.md update for feedback system
- Fix React 19 FormEvent deprecation in FeedbackSection - Wire feedbackDb.close() in graceful shutdown handler - Update CLAUDE.md with feedback API endpoints, architecture, test counts
1 parent a2765de commit d480f4c

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
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

frontend/src/components/FeedbackSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function FeedbackSection() {
1414
? `${publicKey.toBase58().slice(0, 4)}...${publicKey.toBase58().slice(-4)}`
1515
: null;
1616

17-
async function handleSubmit(e: React.FormEvent) {
17+
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
1818
e.preventDefault();
1919
if (content.trim().length < 10) {
2020
setError('Feedback must be at least 10 characters');

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function main() {
4141
log.warn('No mainnet keypair configured — sell payouts disabled');
4242
}
4343

44-
const { app, db } = createApp({ treasury, payout });
44+
const { app, db, feedbackDb } = createApp({ treasury, payout });
4545

4646
// Deposit detector with payout callback
4747
const devnetRpc = createSolanaRpc(config.devnetRpc);
@@ -107,6 +107,7 @@ async function main() {
107107
depositDetector.stop();
108108
buyDetector?.stop();
109109
db.close();
110+
feedbackDb.close();
110111
process.exit(0);
111112
};
112113
process.on('SIGTERM', shutdown);

0 commit comments

Comments
 (0)