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:

  1. Install the Indexer and World Explorer.

    pnpm install @latticexyz/explorer @latticexyz/store-indexer -w
  2. Edit mprocs.yaml.

    mproces.yaml
    procs:
      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:

  1. In the mprocs screen, go down to the explorer process.

  2. Type x to stop the default explorer.

  3. In a different command-line window, go to packages/contract.

  4. Run the explorer using pnpm explorer <options>.

The World Explorer accepts the following CLI options:

OptionDescriptionDefault value
--worldAddressThe address of the world to exploreNone
--worldsFilePath to a worlds configuration file (used to resolve world address)None
--indexerDatabasePath to your SQLite indexer databaseindexer.db
--chainIdThe chain ID of the network31337
--portThe port on which to run the World Explorer13690
--envThe environment to run the World Explorer in (e.g., "development", "production")production

Example setup

An example setup is provided in the examples/local-explorer directory, demonstrating a full setup for using the World Explorer in a local development environment:

Contributing

To contribute to or modify the World Explorer, the easiest way is to run the example setup in development mode:

1. Setup

Navigate to the examples/local-explorer directory and locate the mprocs.yaml file.

2. Configure

In mprocs.yaml, ensure the explorer command is set up correctly. For example:

explorer:
  shell: pnpm explorer --worldsConfigPath packages/contracts/worlds.json --env development
3. Run
pnpm dev

Files can now be edited in the packages/explorer directory, and changes will be reflected in the running World Explorer instance.