From 1a9654418e7b4212de7e8614108d392cda15a8a6 Mon Sep 17 00:00:00 2001 From: Karolis Ramanauskas Date: Tue, 27 Aug 2024 10:16:00 +0300 Subject: [PATCH] feat(templates): add explorer + indexer (#3055) Co-authored-by: Kevin Ingersoll --- .changeset/real-waves-bathe.md | 5 +++++ examples/local-explorer/mprocs.yaml | 4 +++- templates/phaser/.gitignore | 5 ++++- templates/phaser/mprocs.yaml | 10 ++++++++++ templates/phaser/package.json | 2 ++ templates/phaser/packages/contracts/worlds.json | 2 +- templates/react-ecs/.gitignore | 5 ++++- templates/react-ecs/mprocs.yaml | 10 ++++++++++ templates/react-ecs/package.json | 2 ++ templates/react-ecs/packages/contracts/worlds.json | 2 +- templates/react/.gitignore | 5 ++++- templates/react/mprocs.yaml | 10 ++++++++++ templates/react/package.json | 2 ++ templates/react/packages/contracts/worlds.json | 2 +- templates/threejs/.gitignore | 5 ++++- templates/threejs/mprocs.yaml | 10 ++++++++++ templates/threejs/package.json | 2 ++ templates/threejs/packages/contracts/worlds.json | 2 +- templates/vanilla/.gitignore | 5 ++++- templates/vanilla/mprocs.yaml | 10 ++++++++++ templates/vanilla/package.json | 2 ++ templates/vanilla/packages/contracts/worlds.json | 2 +- 22 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 .changeset/real-waves-bathe.md diff --git a/.changeset/real-waves-bathe.md b/.changeset/real-waves-bathe.md new file mode 100644 index 0000000000..a60720e49e --- /dev/null +++ b/.changeset/real-waves-bathe.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/create-mud": patch +--- + +Added `@latticexyz/explorer` and `@latticexyz/store-indexer` to all MUD templates. Updated default `worlds.json` config and world address. diff --git a/examples/local-explorer/mprocs.yaml b/examples/local-explorer/mprocs.yaml index 404b536f2d..ab44f56d3e 100644 --- a/examples/local-explorer/mprocs.yaml +++ b/examples/local-explorer/mprocs.yaml @@ -9,10 +9,12 @@ procs: 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: - shell: pnpm explorer --worldsFile packages/contracts/worlds.json + cwd: packages/contracts + shell: pnpm explorer diff --git a/templates/phaser/.gitignore b/templates/phaser/.gitignore index b512c09d47..c16a9da0e3 100644 --- a/templates/phaser/.gitignore +++ b/templates/phaser/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules + +# mud sqlite indexer data +indexer.db diff --git a/templates/phaser/mprocs.yaml b/templates/phaser/mprocs.yaml index 3f9ca198e3..ab44f56d3e 100644 --- a/templates/phaser/mprocs.yaml +++ b/templates/phaser/mprocs.yaml @@ -8,3 +8,13 @@ procs: 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 diff --git a/templates/phaser/package.json b/templates/phaser/package.json index 2e076feba7..33b712f7cf 100644 --- a/templates/phaser/package.json +++ b/templates/phaser/package.json @@ -14,6 +14,8 @@ "devDependencies": { "@latticexyz/cli": "link:../../packages/cli", "@latticexyz/common": "link:../../packages/common", + "@latticexyz/explorer": "link:../../packages/explorer", + "@latticexyz/store-indexer": "link:../../packages/store-indexer", "@types/debug": "4.1.7", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", diff --git a/templates/phaser/packages/contracts/worlds.json b/templates/phaser/packages/contracts/worlds.json index 43a5a6f4e5..6fed600155 100644 --- a/templates/phaser/packages/contracts/worlds.json +++ b/templates/phaser/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4f4ddafbc93cf8d11a253f21ddbcf836139efdec" + "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b" } } \ No newline at end of file diff --git a/templates/react-ecs/.gitignore b/templates/react-ecs/.gitignore index b512c09d47..c16a9da0e3 100644 --- a/templates/react-ecs/.gitignore +++ b/templates/react-ecs/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules + +# mud sqlite indexer data +indexer.db diff --git a/templates/react-ecs/mprocs.yaml b/templates/react-ecs/mprocs.yaml index 3f9ca198e3..ab44f56d3e 100644 --- a/templates/react-ecs/mprocs.yaml +++ b/templates/react-ecs/mprocs.yaml @@ -8,3 +8,13 @@ procs: 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 diff --git a/templates/react-ecs/package.json b/templates/react-ecs/package.json index 741c071f75..f5d5d40724 100644 --- a/templates/react-ecs/package.json +++ b/templates/react-ecs/package.json @@ -14,6 +14,8 @@ "devDependencies": { "@latticexyz/cli": "link:../../packages/cli", "@latticexyz/common": "link:../../packages/common", + "@latticexyz/explorer": "link:../../packages/explorer", + "@latticexyz/store-indexer": "link:../../packages/store-indexer", "@types/debug": "4.1.7", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", diff --git a/templates/react-ecs/packages/contracts/worlds.json b/templates/react-ecs/packages/contracts/worlds.json index 43a5a6f4e5..6fed600155 100644 --- a/templates/react-ecs/packages/contracts/worlds.json +++ b/templates/react-ecs/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4f4ddafbc93cf8d11a253f21ddbcf836139efdec" + "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b" } } \ No newline at end of file diff --git a/templates/react/.gitignore b/templates/react/.gitignore index b512c09d47..c16a9da0e3 100644 --- a/templates/react/.gitignore +++ b/templates/react/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules + +# mud sqlite indexer data +indexer.db diff --git a/templates/react/mprocs.yaml b/templates/react/mprocs.yaml index 3f9ca198e3..ab44f56d3e 100644 --- a/templates/react/mprocs.yaml +++ b/templates/react/mprocs.yaml @@ -8,3 +8,13 @@ procs: 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 diff --git a/templates/react/package.json b/templates/react/package.json index 5943eb528a..8170c2cf9c 100644 --- a/templates/react/package.json +++ b/templates/react/package.json @@ -14,6 +14,8 @@ "devDependencies": { "@latticexyz/cli": "link:../../packages/cli", "@latticexyz/common": "link:../../packages/common", + "@latticexyz/explorer": "link:../../packages/explorer", + "@latticexyz/store-indexer": "link:../../packages/store-indexer", "@types/debug": "4.1.7", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", diff --git a/templates/react/packages/contracts/worlds.json b/templates/react/packages/contracts/worlds.json index 43a5a6f4e5..6fed600155 100644 --- a/templates/react/packages/contracts/worlds.json +++ b/templates/react/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4f4ddafbc93cf8d11a253f21ddbcf836139efdec" + "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b" } } \ No newline at end of file diff --git a/templates/threejs/.gitignore b/templates/threejs/.gitignore index b512c09d47..c16a9da0e3 100644 --- a/templates/threejs/.gitignore +++ b/templates/threejs/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules + +# mud sqlite indexer data +indexer.db diff --git a/templates/threejs/mprocs.yaml b/templates/threejs/mprocs.yaml index 3f9ca198e3..ab44f56d3e 100644 --- a/templates/threejs/mprocs.yaml +++ b/templates/threejs/mprocs.yaml @@ -8,3 +8,13 @@ procs: 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 diff --git a/templates/threejs/package.json b/templates/threejs/package.json index 1ef7c907f0..eb8f06d5ed 100644 --- a/templates/threejs/package.json +++ b/templates/threejs/package.json @@ -14,6 +14,8 @@ "devDependencies": { "@latticexyz/cli": "link:../../packages/cli", "@latticexyz/common": "link:../../packages/common", + "@latticexyz/explorer": "link:../../packages/explorer", + "@latticexyz/store-indexer": "link:../../packages/store-indexer", "@types/debug": "4.1.7", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", diff --git a/templates/threejs/packages/contracts/worlds.json b/templates/threejs/packages/contracts/worlds.json index 43a5a6f4e5..6fed600155 100644 --- a/templates/threejs/packages/contracts/worlds.json +++ b/templates/threejs/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4f4ddafbc93cf8d11a253f21ddbcf836139efdec" + "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b" } } \ No newline at end of file diff --git a/templates/vanilla/.gitignore b/templates/vanilla/.gitignore index b512c09d47..c16a9da0e3 100644 --- a/templates/vanilla/.gitignore +++ b/templates/vanilla/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules + +# mud sqlite indexer data +indexer.db diff --git a/templates/vanilla/mprocs.yaml b/templates/vanilla/mprocs.yaml index 3f9ca198e3..ab44f56d3e 100644 --- a/templates/vanilla/mprocs.yaml +++ b/templates/vanilla/mprocs.yaml @@ -8,3 +8,13 @@ procs: 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 diff --git a/templates/vanilla/package.json b/templates/vanilla/package.json index 09b9d29c5f..39512b882b 100644 --- a/templates/vanilla/package.json +++ b/templates/vanilla/package.json @@ -14,6 +14,8 @@ "devDependencies": { "@latticexyz/cli": "link:../../packages/cli", "@latticexyz/common": "link:../../packages/common", + "@latticexyz/explorer": "link:../../packages/explorer", + "@latticexyz/store-indexer": "link:../../packages/store-indexer", "@types/debug": "4.1.7", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", diff --git a/templates/vanilla/packages/contracts/worlds.json b/templates/vanilla/packages/contracts/worlds.json index 43a5a6f4e5..6fed600155 100644 --- a/templates/vanilla/packages/contracts/worlds.json +++ b/templates/vanilla/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4f4ddafbc93cf8d11a253f21ddbcf836139efdec" + "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b" } } \ No newline at end of file