Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: world's explorer #2874

Closed
wants to merge 119 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
8b102e9
add indexer to mprocs
karooolis May 27, 2024
9d93f7d
barebones world explorer package setup
karooolis May 27, 2024
dea9dcd
Radix UI themes set-up
karooolis May 27, 2024
a982733
load local db from react app
karooolis May 28, 2024
9fc40b5
use next.js for world explorer
karooolis May 28, 2024
6efa430
react-ecs template setup
karooolis May 28, 2024
ae291c6
initial tables viewer setup
karooolis May 29, 2024
6514feb
tables endpoint
karooolis May 29, 2024
35e624a
tables fetch + select
karooolis May 29, 2024
a1b2783
rows fetch endpoint
karooolis May 29, 2024
8f2a6d9
schema endpoint
karooolis May 29, 2024
5fe680f
improve layout + show rows
karooolis May 29, 2024
254652c
adjust layout
karooolis May 29, 2024
0d40d7b
set default query
karooolis May 29, 2024
f1770d5
fetch table with sql queries ui
karooolis May 29, 2024
0e34a87
refactor db storage
karooolis May 29, 2024
495ee4d
gitignore db changes
karooolis May 29, 2024
c2e8b58
add db util
karooolis May 29, 2024
ec8f157
ts errors
karooolis May 29, 2024
4d3fe95
optional INDEXER_DB_PATH env var
karooolis May 29, 2024
a6e40be
indexer latest follow
karooolis May 29, 2024
4e5fe66
upgrade dev-tools react version
karooolis May 30, 2024
ab2e254
ts error
karooolis May 30, 2024
2962751
undo changes
karooolis May 30, 2024
97ae164
downgrade @react-types
karooolis May 30, 2024
2545f43
use bin script for mprocs
karooolis May 30, 2024
5c14d28
remove worlds-explorer-next, fix build
karooolis May 30, 2024
7b12767
move worlds-explorer-next to worlds-explorer
karooolis May 30, 2024
5dfb6b1
update build script
karooolis May 30, 2024
7cb15e0
delete db + correct bin script
karooolis May 30, 2024
8313ae7
Merge branch 'main' into kumpis/worlds-explorer-local
karooolis May 30, 2024
24e6042
add packaged .next standalone app
karooolis Jun 18, 2024
f1d29cd
undo standalone package add
karooolis Jun 18, 2024
46e574a
undo gitignore change
karooolis Jun 18, 2024
3d604ca
Merge branch 'main' into kumpis/worlds-explorer-local
karooolis Jul 15, 2024
484d72f
add worlds-explorer to all-build cmd
karooolis Jul 15, 2024
e554b68
export world abi fns from cli package
karooolis Jul 15, 2024
e2471cc
world abi endpoint
karooolis Jul 15, 2024
24a6613
add shadcn ui
karooolis Jul 16, 2024
bc3b1ca
display all interact functions
karooolis Jul 16, 2024
2fb01b4
dynamic fetch url
karooolis Jul 16, 2024
6ce0302
add layout container
karooolis Jul 16, 2024
70b689f
wagmi setup
karooolis Jul 17, 2024
4f30ff2
use world env variable
karooolis Jul 17, 2024
3db355b
add wallet connections
karooolis Jul 17, 2024
0fa408e
show fn calls toasts
karooolis Jul 17, 2024
ed947be
add top navigation
karooolis Jul 17, 2024
26c48fe
jump to function
karooolis Jul 17, 2024
30e8969
jump to border
karooolis Jul 17, 2024
00bd542
add latest block display
karooolis Jul 17, 2024
90f7c9a
refactor latest block to separate file
karooolis Jul 17, 2024
3486894
do not show latest block if undefined
karooolis Jul 17, 2024
aa96742
add account selector ui
karooolis Jul 18, 2024
c670a1f
swap latest block order
karooolis Jul 18, 2024
29e2fad
fetch and display balances
karooolis Jul 18, 2024
e5b62c3
switch between accounts
karooolis Jul 18, 2024
03504a9
watch latest block
karooolis Jul 18, 2024
f7c8ca9
add initial table
karooolis Jul 18, 2024
1a9ba93
convert data table to shadcn
karooolis Jul 19, 2024
91d15e4
add loader + rename page
karooolis Jul 19, 2024
705b003
hide selected rows count
karooolis Jul 19, 2024
d5bf604
refactor data table into separate components
karooolis Jul 19, 2024
bb6de0d
use url as table state + increased page size
karooolis Jul 19, 2024
3f12154
add editable row ui
karooolis Jul 19, 2024
e13c4ad
Merge branch 'main' into kumpis/worlds-explorer-local
karooolis Jul 22, 2024
fdb1b73
add dapp metadata for metamask
karooolis Jul 22, 2024
2485c04
pino-pretty webpack config
karooolis Jul 22, 2024
d2fc2f5
ts errors fix
karooolis Jul 22, 2024
bfc812e
upgrade zod
karooolis Jul 22, 2024
58f7851
fix build error
karooolis Jul 22, 2024
d8ef688
update mud config with checkboxes + tasks for testing
karooolis Jul 22, 2024
b0a9a63
add columns filter
karooolis Jul 23, 2024
f1b4601
toggle all columns checkbox
karooolis Jul 23, 2024
3a2f44d
add search highlighter
karooolis Jul 23, 2024
9373d37
add contentEditable row
karooolis Jul 23, 2024
9fcfe1f
add react highlighter types
karooolis Jul 23, 2024
a94b7eb
call world setField directly
karooolis Jul 23, 2024
6f4f214
use world addr from GET params
karooolis Jul 24, 2024
cd9cc88
show all tables cursor pointer
karooolis Jul 24, 2024
4c7eba6
add mud config endpoint, table editing, etc
karooolis Jul 25, 2024
92e4c49
submit tx onBlur
karooolis Jul 25, 2024
03ef397
use camelCase keys
karooolis Jul 26, 2024
86cb2ec
set record for all row values
karooolis Jul 26, 2024
e0cc619
debugging encodeValueArgs
karooolis Jul 26, 2024
097d442
change values of static fields dynamically
karooolis Jul 26, 2024
4a69875
remove isDynamic logic + default font
karooolis Jul 26, 2024
b72425c
show currently active interact fn
karooolis Jul 29, 2024
d3c9c43
design improvements
karooolis Jul 29, 2024
6938949
sticky nav
karooolis Jul 29, 2024
58e66f4
store balances in state, refetch after calls
karooolis Jul 29, 2024
0eb3f8f
cleanup
karooolis Jul 29, 2024
7082fc5
id columns non-editable
karooolis Jul 29, 2024
b587065
do not submit tx if value same
karooolis Jul 29, 2024
fb86796
correct bigint buffer decoding
karooolis Jul 30, 2024
8eb21e2
set records values correctly
karooolis Jul 30, 2024
54a0eb7
add waiting cursor
karooolis Jul 30, 2024
c0fed5a
nav font size change
karooolis Jul 30, 2024
147beb1
submit new data on enter
karooolis Jul 30, 2024
e5cc1db
determine if field is dynamic
karooolis Jul 30, 2024
a4958be
add system calls to abi + jump to improvements
karooolis Jul 31, 2024
c738a60
filter only functions
karooolis Jul 31, 2024
ec26ff6
deduplicate abi functions + only show fns for interact
karooolis Jul 31, 2024
d2b2656
identify type of function
karooolis Jul 31, 2024
d487263
identify type of function left sidebar
karooolis Jul 31, 2024
d688f71
read functions show result
karooolis Jul 31, 2024
096f2b1
read or write btn
karooolis Jul 31, 2024
3af7789
read or write btn
karooolis Jul 31, 2024
59e5e15
add ETH value input
karooolis Aug 1, 2024
890b35e
add functions filter
karooolis Aug 1, 2024
026bf28
fix fns sidebar height
karooolis Aug 1, 2024
3ec569d
css padding fix
karooolis Aug 1, 2024
2cbc160
use setField to update values
karooolis Aug 1, 2024
1fac3fb
add prettier
karooolis Aug 2, 2024
f77e387
sort imports order
karooolis Aug 2, 2024
854acbc
lock non-editable tables
karooolis Aug 2, 2024
22a5979
add offchain table to mud config
karooolis Aug 2, 2024
06b815d
editabletablecell ts errors fix
karooolis Aug 2, 2024
4e8f7ff
increase polling interval
karooolis Aug 2, 2024
9e3bfbd
remove useEffect warning
karooolis Aug 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/packages/contracts/worlds.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"31337": {
"address": "0x7de562d80d6c8672aa32654af67884f411976593"
"address": "0x781ad201b31f188714172cbf1337baa0f1334156"
}
}
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/data/encodeTestData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import config from "../../contracts/mud.config";
export function encodeTestData(testData: Data) {
return mapObject(testData, (records, table) => {
if (!records) return undefined;

const tableConfig = config.tables[table];
return records.map((record) => {
const keySchema = getSchemaTypes(getKeySchema(tableConfig));
const valueSchema = getSchemaTypes(getValueSchema(tableConfig));
const key = encodeKey(keySchema, record.key);
const valueArgs = encodeValueArgs(valueSchema, record.value);
const fieldLayout = valueSchemaToFieldLayoutHex(valueSchema);

return {
key,
...valueArgs,
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"viem": "2.9.20",
"vite": "^4.2.1",
"vitest": "0.34.6",
"zod": "^3.22.2"
"zod": "^3.23.8"
}
}
26 changes: 13 additions & 13 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/latticexyz/mud.git"
},
"scripts": {
"all-build": "for dir in packages/store packages/world packages/world-modules packages/cli test/mock-game-contracts e2e/packages/contracts examples/*/packages/contracts templates/*/packages/contracts; do (cd \"$dir\" && pwd && pnpm build); done",
"all-build": "for dir in packages/store packages/world packages/world-modules packages/worlds-explorer packages/cli test/mock-game-contracts e2e/packages/contracts examples/*/packages/contracts templates/*/packages/contracts; do (cd \"$dir\" && pwd && pnpm build); done",
"all-install": "for dir in . docs e2e examples/* templates/*; do (cd \"$dir\" && pwd && pnpm install); done",
"bench": "pnpm run --recursive bench",
"build": "turbo run build",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"typescript": "5.4.2",
"viem": "2.9.20",
"yargs": "^17.7.1",
"zod": "^3.22.2",
"zod": "^3.23.8",
"zod-validation-error": "^1.3.0"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
// nothing to export

import { functionSignatureToAbiItem } from "./utils/functionSignatureToAbiItem";
import { getWorldAbi } from "./utils/getWorldAbi";
import { getWorldDeploy } from "./deploy/getWorldDeploy";

export { functionSignatureToAbiItem, getWorldAbi, getWorldDeploy };
6 changes: 6 additions & 0 deletions packages/cli/src/utils/functionSignatureToAbiItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { AbiItem, parseAbiItem } from "viem";

export function functionSignatureToAbiItem(functionSignature: string): AbiItem {
const formattedSignature = `function ${functionSignature}`;
return parseAbiItem(formattedSignature);
}
20 changes: 20 additions & 0 deletions packages/cli/src/utils/getWorldAbi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Abi } from "abitype";
import { getSystems } from "../deploy/getSystems";
import { functionSignatureToAbiItem } from "./functionSignatureToAbiItem";
import { Client } from "viem";
import { WorldDeploy } from "../deploy/common";

export async function getWorldAbi({
client,
worldDeploy,
}: {
readonly client: Client;
readonly worldDeploy: WorldDeploy;
}): Promise<Abi> {
const systems = await getSystems({ client, worldDeploy });
const worldAbi = systems.flatMap((system) =>
system.functions.map((func) => functionSignatureToAbiItem(func.signature)),
);

return worldAbi;
}
2 changes: 1 addition & 1 deletion packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({
entry: ["src/index.ts", "src/mud.ts"],
target: "esnext",
format: ["esm"],
dts: !process.env.TSUP_SKIP_DTS,
dts: false, // !process.env.TSUP_SKIP_DTS,
sourcemap: true,
clean: true,
minify: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"dotenv": "^16.0.3",
"fastify": "^4.21.0",
"viem": "2.9.20",
"zod": "^3.22.2"
"zod": "^3.23.8"
},
"devDependencies": {
"@types/debug": "^4.1.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/store-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"superjson": "^1.12.4",
"trpc-koa-adapter": "^1.1.3",
"viem": "2.9.20",
"zod": "^3.22.2"
"zod": "^3.23.8"
},
"devDependencies": {
"@types/accepts": "^1.3.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/store-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"sql.js": "^1.8.0",
"superjson": "^1.12.4",
"viem": "2.9.20",
"zod": "^3.22.2",
"zod": "^3.23.8",
"zustand": "^4.3.7"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/world-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@latticexyz/schema-type": "workspace:*",
"@latticexyz/store": "workspace:*",
"@latticexyz/world": "workspace:*",
"zod": "^3.22.2"
"zod": "^3.23.8"
},
"devDependencies": {
"@latticexyz/abi-ts": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions packages/worlds-explorer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions packages/worlds-explorer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
8 changes: 8 additions & 0 deletions packages/worlds-explorer/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
"prettier-plugin-tailwindcss",
"@trivago/prettier-plugin-sort-imports"
],
"importOrder": ["^[react]", "^@(?!/)", "^@/", "^[./]"],
"importOrderSortSpecifiers": true
}
36 changes: 36 additions & 0 deletions packages/worlds-explorer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
17 changes: 17 additions & 0 deletions packages/worlds-explorer/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
10 changes: 10 additions & 0 deletions packages/worlds-explorer/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
return config;
},
};

export default nextConfig;
Loading
Loading