World Explorer
World Explorer is a GUI tool designed for visually exploring and manipulating the state of worlds. It is available in the MUD TypeScript templates starting with version 2.2.
Installation (for earlier MUD versions)
These are the steps to install World Explorer into a MUD template:
-
Install the Indexer and World Explorer.
pnpm install @latticexyz/explorer @latticexyz/store-indexer -w
-
Edit
mprocs.yaml
.mproces.yamlprocs: client: cwd: packages/client shell: pnpm run dev contracts: cwd: packages/contracts shell: pnpm mud dev-contracts --rpc http://127.0.0.1:8545 anvil: cwd: packages/contracts shell: anvil --base-fee 0 --block-time 2 indexer: cwd: packages/contracts shell: rimraf $SQLITE_FILENAME && pnpm sqlite-indexer env: RPC_HTTP_URL: "http://127.0.0.1:8545" FOLLOW_BLOCK_TAG: "latest" SQLITE_FILENAME: "indexer.db" explorer: cwd: packages/contracts shell: pnpm explorer
Usage
CLI options
To use the explorer with different command-line options, use this process:
-
In the mprocs screen, go down to the explorer process.
-
Type
x
to stop the default explorer. -
In a different command-line window, go to
packages/contract
. -
Run the explorer using
pnpm explorer <options>
.
The World Explorer accepts the following CLI options:
Option | Description | Default value |
---|---|---|
--worldAddress | The address of the world to explore | None |
--worldsFile | Path to a worlds configuration file (used to resolve world address) | None |
--indexerDatabase | Path to your SQLite indexer database | indexer.db |
--chainId | The chain ID of the network | 31337 |
--port | The port on which to run the World Explorer | 13690 |
--env | The environment to run the World Explorer in (e.g., "development", "production") | production |
Contributing
To contribute to or modify the World Explorer, the easiest way is to run the example setup in development
mode.
-
Create a local development setup:
git clone https://github.com/latticexyz/mud.git cd mud pnpm install pnpm build
-
Change to the example directory.
cd examples/local-explorer/
-
Edit the explorer line in
mprocs.yaml
mprocs.yamlprocs: client: cwd: packages/client shell: pnpm run dev contracts: cwd: packages/contracts shell: pnpm mud dev-contracts --rpc http://127.0.0.1:8545 anvil: cwd: packages/contracts shell: anvil --base-fee 0 --block-time 2 indexer: cwd: packages/contracts shell: rimraf $SQLITE_FILENAME && pnpm sqlite-indexer env: RPC_HTTP_URL: "http://127.0.0.1:8545" FOLLOW_BLOCK_TAG: "latest" SQLITE_FILENAME: "indexer.db" explorer: cwd: packages/contracts shell: pnpm explorer --env development
-
Install the libraries and run the application.
pnpm install pnpm dev
-
In a separate command-line window, go to
mud/package/explorer
and modify that package. The code should rebuild automatically after you save changes.If you want to modidy the user interface code, it is at
src/app/worlds/\[worldAddress\]
.