Skip to content

Commit 96337c9

Browse files
committed
feat: add kitchen sink example
1 parent 105af37 commit 96337c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4879
-271
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "dojo-starter"]
22
path = worlds/dojo-starter
3-
url = https://github.com/dojoengine/dojo-starter
3+
url = https://github.com/dojoengine/dojo-starter
4+
[submodule "onchain-dash"]
5+
path = worlds/onchain-dash
6+
url = https://github.com/MartianGreed/onchain-dash
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VITE_RPC_URL="http://localhost:5050"
2+
VITE_RPC_API_KEY=""
3+
VITE_CONTROLLER_URL="https://x.cartridge.gg/mainnet"
4+
VITE_CONTROLLER_RPC="https://x.cartridge.gg/mainnet"
5+
VITE_TORII_URL="http://localhost:8080"
6+
VITE_RELAY_URL="/ip4/127.0.0.1/tcp/9090"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/typescript"]
3+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
.env
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# OnChainDash Vite Kitchen Sink
2+
3+
This project aims at showcasing dojo's capabilities outside of gaming.
4+
5+
## Getting Started
6+
7+
First, install dependencies:
8+
9+
```bash
10+
pnpm install
11+
```
12+
13+
In one terminal window, start katana (the sequencer). If you want to use sepolia / mainnet contracts, you can just use a classic rpc (e.g. `https://rpc.netermind.io/(mainnet|sepolia)-juno`). If this is the case, you can skip the next command.
14+
15+
```bash
16+
katana --disable-fee --allowed-origins "*"
17+
```
18+
19+
In another terminal window, start torii server
20+
21+
```bash
22+
# with katana
23+
torii --world 0x6dd367f5e11f11e0502cb2c4db7ae9bb6d8b5a4a431750bed7bec88b218e12 --allowed-origins "*"
24+
# with mainnet|sepolia
25+
torii --world 0x6dd367f5e11f11e0502cb2c4db7ae9bb6d8b5a4a431750bed7bec88b218e12 --allowed-origins "*" --rpc "https://rpc.nethermind.io/(mainnet|sepolia)-juno?apikey={apikey}" -s 204922
26+
```
27+
28+
Then, start the development server:
29+
30+
```bash
31+
pnpm run dev
32+
```
33+
34+
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
35+
36+
## Local Contracts deployment
37+
38+
In order to make those commands work, you need to have torii & katana running.
39+
40+
```bash
41+
cd src/onchain
42+
sozo build
43+
sozo migrate apply
44+
```
45+
46+
### Notes
47+
48+
- you main want to update `actions` contract address in `src/components/caller-counter.tsx` & `src/components/global-counter.tsx` which is hardcoded in those files.
49+
- if you want to have braavos & argent wallet working, you need to deploy classes and deploy your wallet manually.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "app/globals.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Dojo Onchain Dash</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "sink",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "tsc -b && vite build",
8+
"lint": "eslint .",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"@cartridge/connector": "^0.3.46",
13+
"@dojoengine/core": "workspace:*",
14+
"@dojoengine/sdk": "workspace:*",
15+
"@radix-ui/react-dialog": "^1.1.1",
16+
"@radix-ui/react-dropdown-menu": "^2.1.1",
17+
"@radix-ui/react-icons": "^1.3.0",
18+
"@radix-ui/react-label": "^2.1.0",
19+
"@radix-ui/react-select": "^2.1.1",
20+
"@radix-ui/react-slot": "^1.1.0",
21+
"@radix-ui/react-switch": "^1.1.0",
22+
"@radix-ui/react-tooltip": "^1.1.2",
23+
"@starknet-react/chains": "^3.0.0",
24+
"@starknet-react/core": "2.9.0",
25+
"@t3-oss/env-core": "^0.11.1",
26+
"@t3-oss/env-nextjs": "^0.11.1",
27+
"class-variance-authority": "^0.7.0",
28+
"clsx": "^2.1.1",
29+
"dotenv": "^16.4.5",
30+
"jiti": "^1.21.6",
31+
"lucide-react": "^0.441.0",
32+
"next": "14.2.12",
33+
"react": "^18.3.1",
34+
"react-dom": "^18.3.1",
35+
"react-hook-form": "^7.53.0",
36+
"starknet": "6.11.0",
37+
"tailwind-merge": "^2.5.2",
38+
"tailwindcss-animate": "^1.0.7",
39+
"vaul": "^0.9.9",
40+
"zod": "^3.23.8"
41+
},
42+
"devDependencies": {
43+
"@types/node": "^20.16.10",
44+
"@types/react": "^18.3.10",
45+
"@types/react-dom": "^18.3.0",
46+
"@vitejs/plugin-react": "^4.3.2",
47+
"eslint": "^8.57.1",
48+
"eslint-config-next": "14.2.12",
49+
"postcss": "^8.4.47",
50+
"tailwindcss": "^3.4.13",
51+
"typescript": "^5.6.2",
52+
"vite": "^5.4.8",
53+
"vite-plugin-top-level-await": "^1.4.4",
54+
"vite-plugin-wasm": "^3.3.0",
55+
"vite-preset-react": "^2.3.0"
56+
}
57+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('postcss-load-config').Config} */
2+
const config = {
3+
plugins: {
4+
tailwindcss: {},
5+
},
6+
};
7+
8+
export default config;
Lines changed: 8 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
body {
6+
color: hsl(var(--foreground));
7+
background: hsl(var(--background));
8+
}
9+
10+
@layer utilities {
11+
.text-balance {
12+
text-wrap: balance;
13+
}
14+
}
15+
16+
@layer base {
17+
:root {
18+
--background: 0 0% 100%;
19+
--foreground: 240 10% 3.9%;
20+
--card: 0 0% 100%;
21+
--card-foreground: 240 10% 3.9%;
22+
--popover: 0 0% 100%;
23+
--popover-foreground: 240 10% 3.9%;
24+
--primary: 240 5.9% 10%;
25+
--primary-foreground: 0 0% 98%;
26+
--secondary: 240 4.8% 95.9%;
27+
--secondary-foreground: 240 5.9% 10%;
28+
--muted: 240 4.8% 95.9%;
29+
--muted-foreground: 240 3.8% 46.1%;
30+
--accent: 240 4.8% 95.9%;
31+
--accent-foreground: 240 5.9% 10%;
32+
--destructive: 0 84.2% 60.2%;
33+
--destructive-foreground: 0 0% 98%;
34+
--border: 240 5.9% 90%;
35+
--input: 240 5.9% 90%;
36+
--ring: 240 10% 3.9%;
37+
--chart-1: 12 76% 61%;
38+
--chart-2: 173 58% 39%;
39+
--chart-3: 197 37% 24%;
40+
--chart-4: 43 74% 66%;
41+
--chart-5: 27 87% 67%;
42+
--radius: 0.5rem;
43+
--font-body: var(--font-geist-sans);
44+
--font-heading: var(--font-geist-mono);
45+
}
46+
.dark {
47+
--background: 240 10% 3.9%;
48+
--foreground: 0 0% 98%;
49+
--card: 240 10% 3.9%;
50+
--card-foreground: 0 0% 98%;
51+
--popover: 240 10% 3.9%;
52+
--popover-foreground: 0 0% 98%;
53+
--primary: 0 0% 98%;
54+
--primary-foreground: 240 5.9% 10%;
55+
--secondary: 240 3.7% 15.9%;
56+
--secondary-foreground: 0 0% 98%;
57+
--muted: 240 3.7% 15.9%;
58+
--muted-foreground: 240 5% 64.9%;
59+
--accent: 240 3.7% 15.9%;
60+
--accent-foreground: 0 0% 98%;
61+
--destructive: 0 62.8% 30.6%;
62+
--destructive-foreground: 0 0% 98%;
63+
--border: 240 3.7% 15.9%;
64+
--input: 240 3.7% 15.9%;
65+
--ring: 240 4.9% 83.9%;
66+
--chart-1: 220 70% 50%;
67+
--chart-2: 160 60% 45%;
68+
--chart-3: 30 80% 55%;
69+
--chart-4: 280 65% 60%;
70+
--chart-5: 340 75% 55%;
71+
}
72+
.dojo {
73+
--background: 20 14.3% 4.1%;
74+
--foreground: 0 0% 95%;
75+
--card: 24 9.8% 10%;
76+
--card-foreground: 0 0% 95%;
77+
--popover: 0 0% 9%;
78+
--popover-foreground: 0 0% 95%;
79+
--primary: 346.8 77.2% 49.8%;
80+
--primary-foreground: 355.7 100% 97.3%;
81+
--secondary: 240 3.7% 15.9%;
82+
--secondary-foreground: 0 0% 98%;
83+
--muted: 0 0% 15%;
84+
--muted-foreground: 240 5% 64.9%;
85+
--accent: 12 6.5% 15.1%;
86+
--accent-foreground: 0 0% 98%;
87+
--destructive: 0 62.8% 30.6%;
88+
--destructive-foreground: 0 85.7% 97.3%;
89+
--border: 240 3.7% 15.9%;
90+
--input: 240 3.7% 15.9%;
91+
--ring: 346.8 77.2% 49.8%;
92+
--chart-1: 220 70% 50%;
93+
--chart-2: 160 60% 45%;
94+
--chart-3: 30 80% 55%;
95+
--chart-4: 280 65% 60%;
96+
--chart-5: 340 75% 55%;
97+
}
98+
}
99+
100+
@layer base {
101+
* {
102+
@apply border-border;
103+
}
104+
body {
105+
@apply bg-background text-foreground;
106+
font-family: var(--font-geist-sans);
107+
}
108+
h1, h2, h3, h4, h5, h6, h7 {
109+
font-family: var(--font-geist-sans);
110+
}
111+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { TooltipProvider } from "@/components/ui/tooltip";
2+
3+
import Sidebar from "@/components/sidebar";
4+
import Header from "@/components/header";
5+
import StarknetProvider from "@/components/starknet-provider";
6+
7+
8+
export default function RootLayout({ children }) {
9+
return (
10+
<StarknetProvider>
11+
<TooltipProvider delayDuration={400}>
12+
<div className="grid h-screen w-full pl-[53px]">
13+
<Sidebar />
14+
<div className="flex flex-col">
15+
<Header />
16+
{children}
17+
</div>
18+
</div>
19+
</TooltipProvider>
20+
</StarknetProvider>
21+
);
22+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { useDojoDb } from "@/dojo/provider"
2+
import { useEffect, useState } from "react"
3+
import { OnchainDashSchemaType } from "@/dojo/models"
4+
import { SDK } from "@dojoengine/sdk"
5+
import { Subscription } from "@dojoengine/torii-client"
6+
import GlobalCounter from "@/components/global-counter"
7+
import CallerCounter from "@/components/caller-counter"
8+
import Chat from "@/components/chat"
9+
10+
export default function Home() {
11+
return (
12+
<main className="grid flex-1 gap-4 overflow-auto p-4 md:grid-cols-2 lg:grid-cols-3">
13+
<div
14+
className="relative hidden flex-col items-start gap-8 md:flex" x-chunk="dashboard-03-chunk-0"
15+
>
16+
<div className="grid w-full items-start gap-6">
17+
<fieldset className="grid gap-6 rounded-lg border p-4">
18+
<legend className="-ml-1 px-1 text-sm font-medium">
19+
Settings
20+
</legend>
21+
<div className="grid gap-3">
22+
</div>
23+
</fieldset>
24+
<CallerCounter />
25+
<GlobalCounter />
26+
<fieldset className="grid gap-6 rounded-lg border p-4">
27+
<legend className="-ml-1 px-1 text-sm font-medium">
28+
Stats
29+
</legend>
30+
<div className="grid gap-3">
31+
Some stats about whats happening
32+
</div>
33+
</fieldset>
34+
</div>
35+
</div>
36+
<Chat />
37+
</main>
38+
);
39+
}

0 commit comments

Comments
 (0)