Monorepo for Aesthetic.Computer
aesthetic.computer
1# Keeps: Current State Analysis (December 2025)
2
3**Status**: Mainnet Staging Active
4**Contract**: `KT1JEVyKjsMLts63e4CNaMUywWTPgeQ41Smi` (v3)
5**Last Updated**: December 31, 2025
6
7---
8
9## Recent Changes (December 31, 2025) 🆕
10
11### V3 Contract Deployed
12- [x] New contract `KT1JEVyKjsMLts63e4CNaMUywWTPgeQ41Smi` with owner-editable metadata
13- [x] Contract has `token_creators` bigmap to track original minters
14- [x] `edit_metadata` allows: admin, token owner, OR original creator
15
16### Client-Side Wallet Signing for Metadata Updates
17- [x] Server returns `mode: "prepare"` params for client to sign
18- [x] User's wallet signs `edit_metadata`, preserving objkt.com "Created by" attribution
19- [x] Fixed tokenId==0 bug (JS falsy check issue)
20
21### Token Owner Rebake Support
22- [x] Token owners (not just piece creators) can rebake bundles
23- [x] Wallet connected at rebake time for ownership verification via TzKT
24- [x] Ownership displayed in UI: "★ You own this" or "Owner: tz1abc..."
25
26### Metadata Sync Permissions
27- [x] **Admin**: Always allowed to sync
28- [x] **Original creator**: Always allowed (preserves objkt attribution)
29- [x] **Token owner**: Blocked by default (would change objkt "Created by")
30- [x] Added `allowOwnerEdit` flag for future use (contract supports it)
31- [x] Error explains why token owners can't sync + shows original minter address
32
33### Environment Fixes
34- [x] Added `OVEN_URL=https://localhost:3002` to dev environment
35- [x] Fixed `TZKT_API` undefined in keep-update.mjs
36
37---
38
39## Recent Changes (December 30, 2025) 🆕
40
41### Light/Dark Theme Support
42- [x] Added `export const scheme = { dark: {...}, light: {...} }` to keep.mjs
43- [x] Created `PHASE_COLORS_DARK` and `PHASE_COLORS_LIGHT` for step indicator colors
44- [x] `paint($)` now uses `$.dark` to select palette: `pal = $.dark ? scheme.dark : scheme.light`
45- [x] Background (`wipe()`) adapts to theme
46- [x] Animated progress background adapts to theme
47
48### Button Palette Thematization
49All button color schemes now use centralized palette entries with dark/light variants:
50
51| Button | Purpose |
52|--------|---------|
53| `btnLink` | IPFS links (HTML, THUMBNAIL) |
54| `btnObjkt` | View on objkt marketplace |
55| `btnRebake` | Regenerate cached bundle |
56| `btnSync` | Sync chain metadata |
57| `btnWallet` | Wallet shortcut |
58| `btnContract` | Contract address link |
59| `btnTx` | Transaction hash link |
60| `btnPreview` | Preview piece (pulsing) |
61| `btnConfirm` | Keep It action (pulsing) |
62| `btnLogin` | Login prompt (pulsing) |
63| `btnCached` | Cached media indicator |
64| `btnNet` | Network toggle |
65| `btnView` | View on objkt after mint |
66| `btnToll` | Fee display |
67| `btnStaging` | Staging contract link |
68| `btnRetry` | Retry after error |
69
70Pulsing buttons (`btnPreview`, `btnConfirm`, `btnLogin`) use `normalBase` property for animation calculations while `hover` and `disabled` come directly from palette.
71
72### Fee Reading from Contract
73- [x] `keep-mint.mjs` reads `keep_fee` from contract storage (was hardcoded 5tz)
74- [x] UI shows actual fee from server with `?? 0` fallback
75
76### UI Polish
77- [x] Added "to keep on mainnet staging" text with clickable staging link
78- [x] Fixed Sign Transaction detail text color (was too gray)
79
80---
81
82## What's Already Implemented ✅
83
84### Authentication & Authorization (keep-mint.mjs)
85- [x] JWT authentication via Auth0 (`authorize()`)
86- [x] Handle requirement - must have `@handle` to keep
87- [x] **Ownership verification** - `piece.user === user.sub` check
88- [x] Admin bypass for testing (`hasAdmin()`)
89- [x] Anonymous pieces blocked ("Log in and save it first")
90
91### Wallet Enforcement (keep-mint.mjs)
92- [x] Tezos wallet must be linked (`userDoc.tezos.address`)
93- [x] **Minting wallet MUST match linked wallet** - prevents impersonation
94- [x] Server-side minting with admin key for actual Tezos tx
95
96### Minting Flow (keep.mjs UI + keep-mint.mjs)
97- [x] 10-step timeline UI with progress feedback
98- [x] SSE streaming for real-time updates
99- [x] Bundle HTML generation (self-contained artifact)
100- [x] Thumbnail WebP via oven (256×256 @ 2x = 512×512)
101- [x] IPFS upload via Pinata
102- [x] Duplicate prevention (`content_hashes` bigmap)
103- [x] Already-minted detection with existing token info
104- [x] Confirmation step before minting
105
106### Rebake Flow (keep.mjs + keep-mint.mjs)
107- [x] Regenerate bundle for already-minted piece (`regenerate=true`)
108- [x] Cached IPFS media detection (skip if source unchanged)
109- [x] `ipfsMedia` tracking in MongoDB
110- [x] `pendingRebake` flag when bundle differs from on-chain
111
112### Metadata Update (keep-update.mjs)
113- [x] `edit_metadata` entrypoint call
114- [x] **Preserves original artist** - fetches `firstMinter` from TzKT
115- [x] Updates `artifactUri`, `thumbnailUri`, `attributes` on-chain
116- [x] Admin-only (for now) - requires server signing key
117
118### Database Tracking (keep-confirm.mjs)
119- [x] Records successful mints in `kidlisp` collection
120- [x] Stores `kept` object: tokenId, txHash, wallet, URIs, timestamps
121- [x] Ownership verification before confirming
122
123---
124
125## What's Actually Next 🎯
126
127### ✅ COMPLETED (December 31, 2025)
128- [x] V3 contract with owner/creator editable metadata
129- [x] Client-side signing for edit_metadata (preserves attribution)
130- [x] Token owner can rebake (regenerate bundle)
131- [x] Sync restricted to original creator (protects objkt attribution)
132- [x] Ownership display in UI
133
134### 🚀 READY FOR PRODUCTION
135Before moving from staging to production contract:
136- [ ] Test full flow: mint → transfer → owner rebake → creator sync
137- [ ] Fix $roz attribution (sync with aesthetic.tez wallet)
138- [ ] Consider: Should we burn+remint test tokens or keep them?
139
140### 📋 Missing Features from Plan
141- [ ] `keeps` command to list user's minted tokens
142- [x] `keep $code` already checks minted state and shows existing keep UI
143- [x] Cancel button + Escape during preparation
144- [ ] Show estimated gas/fees before signing
145- [ ] Copy share link after mint
146
147### 🎨 kidlisp.com Integration
148- [ ] "Mint as Keep" button for logged-in users
149- [ ] "My Keeps" section
150- [ ] Gallery of recent keeps
151
152### 🔧 Developer Experience
153- [ ] Auto-restart site on Netlify function error
154- [ ] Better error messages in console
155- [ ] Site health monitoring in artery
156
157---
158
159## Environment Variables (Already Configured)
160
161```env
162KEEPS_NETWORK=mainnet
163KEEPS_CONTRACT=KT1EcsqR69BHekYF5mDQquxrvNg5HhPFx6NM
164OVEN_URL=https://oven.aesthetic.computer
165# Secrets in MongoDB 'secrets' collection:
166# pinata: { apiKey, apiSecret, jwt }
167# tezos-kidlisp: { address, publicKey, privateKey }
168```
169
170---
171
172## Files Reference
173
174| File | Purpose |
175|------|---------|
176| `system/netlify/functions/keep-mint.mjs` | Streaming SSE mint endpoint |
177| `system/netlify/functions/keep-update.mjs` | On-chain metadata update (prepare mode for client signing) |
178| `system/netlify/functions/keep-update-confirm.mjs` | Record successful metadata update (NEW) |
179| `system/netlify/functions/keep-confirm.mjs` | Record successful mint |
180| `system/public/aesthetic.computer/disks/keep.mjs` | Keep UI/flow (~3000 lines) |
181| `system/public/aesthetic.computer/lib/keep/tezos-wallet.mjs` | Beacon wallet |
182| `tezos/keeps.mjs` | CLI tool for admin ops |