A Prediction Market on the AT Protocol

chore(package.json): cleanup

Ciaran 780d030c 17a72e11

+1 -125
-66
example.log
··· 1 - create { 2 - rev: "3mg6czrjigj27", 3 - operation: "create", 4 - collection: "za.co.ciaran.cumulus.market", 5 - rkey: "3mg6czrivur27", 6 - record: { 7 - $type: "za.co.ciaran.cumulus.market", 8 - closesAt: "2026-05-03T17:43:56.706Z", 9 - createdAt: "2026-03-03T17:43:56.709Z", 10 - liquidity: 50, 11 - question: "What will I do?", 12 - }, 13 - cid: "bafyreihvnkc4k4x6gc2qh2paoxcig66f77kydncwqzxlqvz4gwzu6wunyu", 14 - } 15 - create { 16 - rev: "3mg6czrtnxz24", 17 - operation: "create", 18 - collection: "za.co.ciaran.cumulus.bet", 19 - rkey: "3mg6czrt5er24", 20 - record: { 21 - $type: "za.co.ciaran.cumulus.bet", 22 - createdAt: "2026-03-03T17:43:57.522Z", 23 - market: { 24 - $type: "com.atproto.repo.strongRef", 25 - cid: "bafyreihvnkc4k4x6gc2qh2paoxcig66f77kydncwqzxlqvz4gwzu6wunyu", 26 - uri: "at://did:plc:ssntylce6aeeazwb64ol6nsj/za.co.ciaran.cumulus.market/3mg6czrivur27", 27 - }, 28 - position: "yes", 29 - }, 30 - cid: "bafyreib5koypyneafy5kke2qmlwvvtg5pfqmptqvha4exdbiettppkchzi", 31 - } 32 - create { 33 - rev: "3mg6czs52sy2k", 34 - operation: "create", 35 - collection: "za.co.ciaran.cumulus.resolution", 36 - rkey: "3mg6czs4o4q2k", 37 - record: { 38 - $type: "za.co.ciaran.cumulus.resolution", 39 - answer: "yes", 40 - createdAt: "2026-03-03T17:43:57.837Z", 41 - market: { 42 - $type: "com.atproto.repo.strongRef", 43 - cid: "bafyreihvnkc4k4x6gc2qh2paoxcig66f77kydncwqzxlqvz4gwzu6wunyu", 44 - uri: "at://did:plc:ssntylce6aeeazwb64ol6nsj/za.co.ciaran.cumulus.market/3mg6czrivur27", 45 - }, 46 - }, 47 - cid: "bafyreigqjpvuogpowigrvknes5hpqtjrhjo46o2cl4uxdh4yirywiqvnt4", 48 - } 49 - delete { 50 - rev: "3mg6d3vpiby2c", 51 - operation: "delete", 52 - collection: "za.co.ciaran.cumulus.bet", 53 - rkey: "3mg6czrt5er24", 54 - } 55 - delete { 56 - rev: "3mg6d3za6dy2z", 57 - operation: "delete", 58 - collection: "za.co.ciaran.cumulus.market", 59 - rkey: "3mg6czrivur27", 60 - } 61 - delete { 62 - rev: "3mg6d446p7o2r", 63 - operation: "delete", 64 - collection: "za.co.ciaran.cumulus.resolution", 65 - rkey: "3mg6czs4o4q2k", 66 - }
+1 -3
package.json
··· 5 5 "lex:generate": "bun lex-cli export && bun lex-cli generate", 6 6 "lex:lint": "goat lex lint generated && goat lex check-dns generated", 7 7 "lex:publish": "goat lex publish generated", 8 - "db:push": "bunx drizzle-kit push", 9 8 "db:generate": "bunx drizzle-kit generate", 10 9 "db:migrate": "bunx drizzle-kit migrate", 10 + "db:push": "bunx drizzle-kit push", 11 11 "jetstream:dev": "bun --watch src/jetstream/index.ts", 12 12 "jetstream:build": "bun build src/jetstream/index.ts --compile --outfile build/jetstream", 13 13 "web:dev": "vite", 14 14 "web:build": "vite build", 15 - "web:preview": "vite preview", 16 15 "server:dev": "bun --watch src/server/index.ts", 17 16 "server:build": "bun build src/server/index.ts --compile --outfile build/server", 18 - "docker:build": "sudo -E docker build --pull -t cumulus .", 19 17 "build": "bun jetstream:build && bun web:build && bun server:build", 20 18 "build:dev": "bun jetstream:build && LOCAL=1 bun web:build && bun server:build", 21 19 "test": "bun vitest"
-56
t
··· 1 - diff --git a/src/server/index.ts b/src/server/index.ts 2 - index b100294..8595011 100644 3 - --- a/src/server/index.ts 4 - +++ b/src/server/index.ts 5 - @@ -14,9 +14,10 @@ export const app = new Elysia() 6 - .use(staticPlugin({ prefix: "/", assets: "dist" })) 7 - .get("/", () => new Response(Bun.file("dist/index.html"))) 8 - .group("/api", (app) => ( 9 - - app.get("/markets", async ({ params }) => 10 - + app.get("/markets", async () => 11 - Response.json(await db.query.marketsTable.findMany({ 12 - - with: { bets: true, resolution: true } 13 - + with: { bets: true, resolution: true }, 14 - + orderBy: (markets, { desc }) => [desc(markets.createdAt)], 15 - })) 16 - ).group("/market", (app) => ( 17 - app.get("/:uri", async ({ params: { uri } }) => 18 - diff --git a/src/web/app.tsx b/src/web/app.tsx 19 - index 1fdd125..ff39ead 100644 20 - --- a/src/web/app.tsx 21 - +++ b/src/web/app.tsx 22 - @@ -25,30 +25,22 @@ export default function App() { 23 - yes, 24 - no, 25 - yesPrice: yesPrice(yes, no, market.liquidity), 26 - - testNoPrice: 1-yesPrice(yes,no,market.liquidity), 27 - noPrice: noPrice(yes, no, market.liquidity), 28 - } 29 - }) 30 -  31 - - 32 - - return <div key={market.cid}> 33 - - <h2>{market.question}</h2> 34 - - <p>Closes {formatDistance(new Date(market.closesAt), new Date(), { addSuffix: true })}</p> 35 - - <p>{market.bets?.length} Positions</p> 36 - + return <div key={market.cid} className="space-y-2"> 37 - + <h2 className="text-3xl font-medium">{market.question}</h2> 38 - + <p className="uppercase text-sm font-bold">Closes {formatDistance(new Date(market.closesAt), new Date(), { addSuffix: true })} | {market.bets?.length} Positions</p> 39 - <ChartContainer 40 - - className="border-2 rounded-lg" 41 - config={{ 42 - yes: { label: "Yes" }, no: { label: "No" } 43 - }}> 44 - <LineChart data={mappedBets}> 45 - - <CartesianGrid strokeDasharray="3 3" /> 46 - <ChartTooltip /> 47 - - <XAxis dataKey="createdAt" interval={8} /> 48 - <Line dataKey="yes" stroke="var(--color-shell-600)" /> 49 - <Line dataKey="no" stroke="var(--color-coral-600)" /> 50 - - <Line dataKey="yesPrice" stroke="var(--color-coral-600)" /> 51 - - <Line dataKey="testNoPrice" stroke="var(--color-coral-600)" /> 52 - - <Line dataKey="noPrice" stroke="var(--color-coral-600)" /> 53 - + <Line dataKey="yesPrice" /> 54 - </LineChart> 55 - </ChartContainer> 56 - </div>