create-mud 2.2.16 → 2.2.17-03eae1330cef5cae129841958fb75541ef13fb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/bin/cli.js +4 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/package.json +17 -11
- package/templates/phaser/packages/contracts/worlds.json +5 -0
- package/templates/react/.gitignore_ +16 -0
- package/templates/react/mprocs.yaml +21 -0
- package/templates/react/package.json +31 -0
- package/templates/react/packages/client/.gitignore_ +1 -0
- package/{dist/templates/threejs → templates/react}/packages/client/index.html +2 -2
- package/{dist/templates → templates}/react/packages/client/package.json +17 -9
- package/templates/react/packages/client/postcss.config.cjs +6 -0
- package/templates/react/packages/client/src/App.tsx +46 -0
- package/templates/react/packages/client/src/Providers.tsx +35 -0
- package/templates/react/packages/client/src/common.ts +26 -0
- package/templates/react/packages/client/src/game/GameMap.tsx +102 -0
- package/templates/react/packages/client/src/game/useKeyboardMovement.ts +26 -0
- package/templates/react/packages/client/src/index.tsx +19 -0
- package/templates/react/packages/client/src/mud/Explorer.tsx +32 -0
- package/templates/react/packages/client/src/mud/Synced.tsx +14 -0
- package/templates/react/packages/client/src/mud/stash.ts +4 -0
- package/templates/react/packages/client/src/mud/useSyncStatus.ts +21 -0
- package/templates/react/packages/client/src/mud/useWorldContract.ts +44 -0
- package/templates/react/packages/client/src/ui/AsyncButton.tsx +41 -0
- package/templates/react/packages/client/src/ui/ErrorFallback.tsx +58 -0
- package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
- package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
- package/templates/react/packages/client/src/wagmiConfig.ts +49 -0
- package/templates/react/packages/client/tailwind.config.ts +10 -0
- package/templates/react/packages/client/tsconfig.json +11 -0
- package/{dist/templates/threejs → templates/react}/packages/client/vite.config.ts +2 -7
- package/templates/react/packages/contracts/.env +11 -0
- package/templates/react/packages/contracts/.gitignore_ +13 -0
- package/templates/react/packages/contracts/mud.config.ts +14 -0
- package/templates/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +2021 -0
- package/{dist/templates/vanilla → templates/react}/packages/contracts/package.json +1 -0
- package/{dist/templates → templates}/react/packages/contracts/script/PostDeploy.s.sol +1 -9
- package/templates/react/packages/contracts/src/MoveSystem.sol +26 -0
- package/{dist/templates/react/packages/contracts/src/codegen/index.sol → templates/react/packages/contracts/src/codegen/common.sol} +6 -1
- package/templates/react/packages/contracts/src/codegen/tables/Position.sol +318 -0
- package/{dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol → templates/react/packages/contracts/src/codegen/world/IMoveSystem.sol} +5 -3
- package/templates/react/packages/contracts/test/MoveTest.t.sol +25 -0
- package/templates/react/packages/contracts/test/WorldTest.t.sol +16 -0
- package/templates/react/packages/contracts/worlds.json +5 -0
- package/templates/react-ecs/.gitignore_ +16 -0
- package/templates/react-ecs/mprocs.yaml +21 -0
- package/templates/react-ecs/packages/client/.gitignore_ +1 -0
- package/{dist/templates/react → templates/react-ecs}/packages/client/index.html +2 -2
- package/{dist/templates → templates}/react-ecs/packages/client/package.json +16 -9
- package/templates/react-ecs/packages/client/postcss.config.cjs +6 -0
- package/templates/react-ecs/packages/client/src/App.tsx +74 -0
- package/templates/react-ecs/packages/client/src/Providers.tsx +29 -0
- package/templates/react-ecs/packages/client/src/common.ts +27 -0
- package/templates/react-ecs/packages/client/src/game/GameMap.tsx +112 -0
- package/templates/react-ecs/packages/client/src/game/useKeyboardMovement.ts +26 -0
- package/templates/react-ecs/packages/client/src/index.tsx +19 -0
- package/templates/react-ecs/packages/client/src/mud/Explorer.tsx +32 -0
- package/templates/react-ecs/packages/client/src/mud/Synced.tsx +14 -0
- package/templates/react-ecs/packages/client/src/mud/recs.ts +6 -0
- package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +17 -0
- package/templates/react-ecs/packages/client/src/mud/useWorldContract.ts +44 -0
- package/templates/react-ecs/packages/client/src/ui/AsyncButton.tsx +41 -0
- package/templates/react-ecs/packages/client/src/ui/ErrorFallback.tsx +58 -0
- package/templates/react-ecs/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
- package/templates/react-ecs/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
- package/templates/react-ecs/packages/client/src/wagmiConfig.ts +49 -0
- package/templates/react-ecs/packages/client/tailwind.config.ts +10 -0
- package/{dist/templates/threejs → templates/react-ecs}/packages/client/tsconfig.json +1 -1
- package/{dist/templates/react → templates/react-ecs}/packages/client/vite.config.ts +2 -7
- package/{dist/templates/threejs → templates/react-ecs}/packages/contracts/.env +1 -1
- package/templates/react-ecs/packages/contracts/.gitignore_ +13 -0
- package/templates/react-ecs/packages/contracts/mud.config.ts +18 -0
- package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +2039 -0
- package/{dist/templates/react → templates/react-ecs}/packages/contracts/package.json +1 -0
- package/{dist/templates/vanilla → templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +1 -5
- package/templates/react-ecs/packages/contracts/src/Entity.sol +20 -0
- package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +30 -0
- package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +18 -0
- package/{dist/templates/vanilla/packages/contracts/src/codegen/index.sol → templates/react-ecs/packages/contracts/src/codegen/common.sol} +6 -1
- package/templates/react-ecs/packages/contracts/src/codegen/index.sol +8 -0
- package/{dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol → templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol} +35 -35
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +202 -0
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +321 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +16 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +15 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +17 -0
- package/templates/react-ecs/packages/contracts/src/createEntity.sol +11 -0
- package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +39 -0
- package/templates/react-ecs/packages/contracts/test/WorldTest.t.sol +16 -0
- package/templates/react-ecs/packages/contracts/worlds.json +5 -0
- package/templates/threejs/packages/contracts/src/codegen/index.sol +6 -0
- package/{dist/templates/react → templates/threejs}/packages/contracts/src/codegen/world/IWorld.sol +2 -2
- package/templates/threejs/packages/contracts/worlds.json +5 -0
- package/templates/vanilla/packages/contracts/worlds.json +5 -0
- package/dist/templates/phaser/packages/contracts/worlds.json +0 -5
- package/dist/templates/react/packages/client/src/App.tsx +0 -105
- package/dist/templates/react/packages/client/src/MUDContext.tsx +0 -21
- package/dist/templates/react/packages/client/src/index.tsx +0 -34
- package/dist/templates/react/packages/client/src/mud/createSystemCalls.ts +0 -56
- package/dist/templates/react/packages/client/src/mud/getNetworkConfig.ts +0 -76
- package/dist/templates/react/packages/client/src/mud/setup.ts +0 -18
- package/dist/templates/react/packages/client/src/mud/setupNetwork.ts +0 -101
- package/dist/templates/react/packages/contracts/mud.config.ts +0 -16
- package/dist/templates/react/packages/contracts/src/codegen/tables/Tasks.sol +0 -522
- package/dist/templates/react/packages/contracts/src/codegen/world/ITasksSystem.sol +0 -19
- package/dist/templates/react/packages/contracts/src/systems/TasksSystem.sol +0 -24
- package/dist/templates/react/packages/contracts/test/TasksTest.t.sol +0 -30
- package/dist/templates/react/packages/contracts/worlds.json +0 -5
- package/dist/templates/react-ecs/package.json +0 -32
- package/dist/templates/react-ecs/packages/client/src/App.tsx +0 -29
- package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +0 -51
- package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +0 -77
- package/dist/templates/react-ecs/packages/contracts/worlds.json +0 -5
- package/dist/templates/threejs/gitignore +0 -7
- package/dist/templates/threejs/mprocs.yaml +0 -13
- package/dist/templates/threejs/packages/client/gitignore +0 -3
- package/dist/templates/threejs/packages/client/src/MUDContext.tsx +0 -21
- package/dist/templates/threejs/packages/client/src/index.tsx +0 -34
- package/dist/templates/threejs/packages/client/src/mud/supportedChains.ts +0 -20
- package/dist/templates/threejs/packages/contracts/gitignore +0 -9
- package/dist/templates/threejs/packages/contracts/worlds.json +0 -5
- package/dist/templates/vanilla/gitignore +0 -7
- package/dist/templates/vanilla/mprocs.yaml +0 -13
- package/dist/templates/vanilla/packages/client/gitignore +0 -3
- package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setup.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +0 -106
- package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +0 -20
- package/dist/templates/vanilla/packages/client/src/mud/world.ts +0 -3
- package/dist/templates/vanilla/packages/client/tsconfig.json +0 -11
- package/dist/templates/vanilla/packages/contracts/.env +0 -11
- package/dist/templates/vanilla/packages/contracts/gitignore +0 -9
- package/dist/templates/vanilla/packages/contracts/mud.config.ts +0 -13
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +0 -16
- package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +0 -14
- package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +0 -31
- package/dist/templates/vanilla/packages/contracts/worlds.json +0 -5
- /package/{dist/templates → templates}/phaser/.eslintrc +0 -0
- /package/{dist/templates → templates}/phaser/.gitattributes +0 -0
- /package/{dist/templates/phaser/gitignore → templates/phaser/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/phaser/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/phaser/package.json +0 -0
- /package/{dist/templates/phaser/packages/art/gitignore → templates/phaser/packages/art/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/README.md +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/config-sprites.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/cli.mjs +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/images/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/world.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.env +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.eslintrc +0 -0
- /package/{dist/templates/phaser/packages/client/gitignore → templates/phaser/packages/client/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/index.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/store.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/App.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/vite.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.env +0 -0
- /package/{dist/templates/phaser/packages/contracts/gitignore → templates/phaser/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/phaser/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/phaser/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/.gitattributes +0 -0
- /package/{dist/templates → templates}/react/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/react/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react/packages/client/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/threejs → templates/react}/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates/threejs → templates/react}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.eslintrc +0 -0
- /package/{dist/templates → templates}/react-ecs/.gitattributes +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/settings.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/package.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.eslintrc +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react-ecs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react-ecs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/threejs/.eslintrc +0 -0
- /package/{dist/templates → templates}/threejs/.gitattributes +0 -0
- /package/{dist/templates/react-ecs/gitignore → templates/threejs/.gitignore_} +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/settings.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/threejs/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.eslintrc +0 -0
- /package/{dist/templates/react-ecs/packages/client/gitignore → templates/threejs/packages/client/.gitignore_} +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/App.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/MUDContext.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/index.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/contracts/.env +0 -0
- /package/{dist/templates/react-ecs/packages/contracts/gitignore → templates/threejs/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/threejs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/threejs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/.eslintrc +0 -0
- /package/{dist/templates → templates}/vanilla/.gitattributes +0 -0
- /package/{dist/templates/react/gitignore → templates/vanilla/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/settings.json +0 -0
- /package/{dist/templates/react → templates/vanilla}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/.env +0 -0
- /package/{dist/templates/react/packages/client/gitignore → templates/vanilla/packages/client/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/index.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/react → templates/vanilla}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates/react → templates/vanilla}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react → templates/vanilla}/packages/contracts/.env +0 -0
- /package/{dist/templates/react/packages/contracts/gitignore → templates/vanilla/packages/contracts/.gitignore_} +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/vanilla/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/tsconfig.json +0 -0
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Create the system calls that the client can use to ask
|
|
3
|
-
* for changes in the World state (using the System contracts).
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Hex } from "viem";
|
|
7
|
-
import { SetupNetworkResult } from "./setupNetwork";
|
|
8
|
-
|
|
9
|
-
export type SystemCalls = ReturnType<typeof createSystemCalls>;
|
|
10
|
-
|
|
11
|
-
export function createSystemCalls(
|
|
12
|
-
/*
|
|
13
|
-
* The parameter list informs TypeScript that:
|
|
14
|
-
*
|
|
15
|
-
* - The first parameter is expected to be a
|
|
16
|
-
* SetupNetworkResult, as defined in setupNetwork.ts
|
|
17
|
-
*
|
|
18
|
-
* Out of this parameter, we only care about two fields:
|
|
19
|
-
* - worldContract (which comes from getContract, see
|
|
20
|
-
* https://github.com/latticexyz/mud/blob/main/templates/react/packages/client/src/mud/setupNetwork.ts#L63-L69).
|
|
21
|
-
*
|
|
22
|
-
* - waitForTransaction (which comes from syncToRecs, see
|
|
23
|
-
* https://github.com/latticexyz/mud/blob/main/templates/react/packages/client/src/mud/setupNetwork.ts#L77-L83).
|
|
24
|
-
*
|
|
25
|
-
* - From the second parameter, which is a ClientComponent,
|
|
26
|
-
* we only care about Counter. This parameter comes to use
|
|
27
|
-
* through createClientComponents.ts, but it originates in
|
|
28
|
-
* syncToRecs
|
|
29
|
-
* (https://github.com/latticexyz/mud/blob/main/templates/react/packages/client/src/mud/setupNetwork.ts#L77-L83).
|
|
30
|
-
*/
|
|
31
|
-
{ tables, useStore, worldContract, waitForTransaction }: SetupNetworkResult,
|
|
32
|
-
) {
|
|
33
|
-
const addTask = async (label: string) => {
|
|
34
|
-
const tx = await worldContract.write.app__addTask([label]);
|
|
35
|
-
await waitForTransaction(tx);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const toggleTask = async (id: Hex) => {
|
|
39
|
-
const isComplete = (useStore.getState().getValue(tables.Tasks, { id })?.completedAt ?? 0n) > 0n;
|
|
40
|
-
const tx = isComplete
|
|
41
|
-
? await worldContract.write.app__resetTask([id])
|
|
42
|
-
: await worldContract.write.app__completeTask([id]);
|
|
43
|
-
await waitForTransaction(tx);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const deleteTask = async (id: Hex) => {
|
|
47
|
-
const tx = await worldContract.write.app__deleteTask([id]);
|
|
48
|
-
await waitForTransaction(tx);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
addTask,
|
|
53
|
-
toggleTask,
|
|
54
|
-
deleteTask,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Network specific configuration for the client.
|
|
3
|
-
* By default connect to the anvil test network.
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* By default the template just creates a temporary wallet
|
|
9
|
-
* (called a burner wallet).
|
|
10
|
-
*/
|
|
11
|
-
import { getBurnerPrivateKey } from "@latticexyz/common";
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
* Import the addresses of the World, possibly on multiple chains,
|
|
15
|
-
* from packages/contracts/worlds.json. When the contracts package
|
|
16
|
-
* deploys a new `World`, it updates this file.
|
|
17
|
-
*/
|
|
18
|
-
import worlds from "contracts/worlds.json";
|
|
19
|
-
|
|
20
|
-
/*
|
|
21
|
-
* The supported chains.
|
|
22
|
-
*/
|
|
23
|
-
import { supportedChains } from "./supportedChains";
|
|
24
|
-
|
|
25
|
-
export async function getNetworkConfig() {
|
|
26
|
-
const params = new URLSearchParams(window.location.search);
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
* The chain ID is the first item available from this list:
|
|
30
|
-
* 1. chainId query parameter
|
|
31
|
-
* 2. chainid query parameter
|
|
32
|
-
* 3. The VITE_CHAIN_ID environment variable set when the
|
|
33
|
-
* vite dev server was started or client was built
|
|
34
|
-
* 4. The default, 31337 (anvil)
|
|
35
|
-
*/
|
|
36
|
-
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* Find the chain (unless it isn't in the list of supported chains).
|
|
40
|
-
*/
|
|
41
|
-
const chainIndex = supportedChains.findIndex((c) => c.id === chainId);
|
|
42
|
-
const chain = supportedChains[chainIndex];
|
|
43
|
-
if (!chain) {
|
|
44
|
-
throw new Error(`Chain ${chainId} not found`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/*
|
|
48
|
-
* Get the address of the World. If you want to use a
|
|
49
|
-
* different address than the one in worlds.json,
|
|
50
|
-
* provide it as worldAddress in the query string.
|
|
51
|
-
*/
|
|
52
|
-
const world = worlds[chain.id.toString()];
|
|
53
|
-
const worldAddress = params.get("worldAddress") || world?.address;
|
|
54
|
-
if (!worldAddress) {
|
|
55
|
-
throw new Error(`No world address found for chain ${chainId}. Did you run \`mud deploy\`?`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/*
|
|
59
|
-
* MUD clients use events to synchronize the database, meaning
|
|
60
|
-
* they need to look as far back as when the World was started.
|
|
61
|
-
* The block number for the World start can be specified either
|
|
62
|
-
* on the URL (as initialBlockNumber) or in the worlds.json
|
|
63
|
-
* file. If neither has it, it starts at the first block, zero.
|
|
64
|
-
*/
|
|
65
|
-
const initialBlockNumber = params.has("initialBlockNumber")
|
|
66
|
-
? Number(params.get("initialBlockNumber"))
|
|
67
|
-
: world?.blockNumber ?? 0n;
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
privateKey: getBurnerPrivateKey(),
|
|
71
|
-
chainId,
|
|
72
|
-
chain,
|
|
73
|
-
worldAddress,
|
|
74
|
-
initialBlockNumber,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file sets up all the definitions required for a MUD client.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createSystemCalls } from "./createSystemCalls";
|
|
6
|
-
import { setupNetwork } from "./setupNetwork";
|
|
7
|
-
|
|
8
|
-
export type SetupResult = Awaited<ReturnType<typeof setup>>;
|
|
9
|
-
|
|
10
|
-
export async function setup() {
|
|
11
|
-
const network = await setupNetwork();
|
|
12
|
-
const systemCalls = createSystemCalls(network);
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
network,
|
|
16
|
-
systemCalls,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MUD client code is built on top of viem
|
|
3
|
-
* (https://viem.sh/docs/getting-started.html).
|
|
4
|
-
* This line imports the functions we need from it.
|
|
5
|
-
*/
|
|
6
|
-
import {
|
|
7
|
-
createPublicClient,
|
|
8
|
-
fallback,
|
|
9
|
-
webSocket,
|
|
10
|
-
http,
|
|
11
|
-
createWalletClient,
|
|
12
|
-
Hex,
|
|
13
|
-
ClientConfig,
|
|
14
|
-
getContract,
|
|
15
|
-
} from "viem";
|
|
16
|
-
import { syncToZustand } from "@latticexyz/store-sync/zustand";
|
|
17
|
-
import { getNetworkConfig } from "./getNetworkConfig";
|
|
18
|
-
import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json";
|
|
19
|
-
import { createBurnerAccount, transportObserver, ContractWrite } from "@latticexyz/common";
|
|
20
|
-
import { transactionQueue, writeObserver } from "@latticexyz/common/actions";
|
|
21
|
-
import { Subject, share } from "rxjs";
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
* Import our MUD config, which includes strong types for
|
|
25
|
-
* our tables and other config options. We use this to generate
|
|
26
|
-
* things like RECS components and get back strong types for them.
|
|
27
|
-
*
|
|
28
|
-
* See https://mud.dev/templates/typescript/contracts#mudconfigts
|
|
29
|
-
* for the source of this information.
|
|
30
|
-
*/
|
|
31
|
-
import mudConfig from "contracts/mud.config";
|
|
32
|
-
|
|
33
|
-
export type SetupNetworkResult = Awaited<ReturnType<typeof setupNetwork>>;
|
|
34
|
-
|
|
35
|
-
export async function setupNetwork() {
|
|
36
|
-
const networkConfig = await getNetworkConfig();
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* Create a viem public (read only) client
|
|
40
|
-
* (https://viem.sh/docs/clients/public.html)
|
|
41
|
-
*/
|
|
42
|
-
const clientOptions = {
|
|
43
|
-
chain: networkConfig.chain,
|
|
44
|
-
transport: transportObserver(fallback([webSocket(), http()])),
|
|
45
|
-
pollingInterval: 1000,
|
|
46
|
-
} as const satisfies ClientConfig;
|
|
47
|
-
|
|
48
|
-
const publicClient = createPublicClient(clientOptions);
|
|
49
|
-
|
|
50
|
-
/*
|
|
51
|
-
* Create an observable for contract writes that we can
|
|
52
|
-
* pass into MUD dev tools for transaction observability.
|
|
53
|
-
*/
|
|
54
|
-
const write$ = new Subject<ContractWrite>();
|
|
55
|
-
|
|
56
|
-
/*
|
|
57
|
-
* Create a temporary wallet and a viem client for it
|
|
58
|
-
* (see https://viem.sh/docs/clients/wallet.html).
|
|
59
|
-
*/
|
|
60
|
-
const burnerAccount = createBurnerAccount(networkConfig.privateKey as Hex);
|
|
61
|
-
const burnerWalletClient = createWalletClient({
|
|
62
|
-
...clientOptions,
|
|
63
|
-
account: burnerAccount,
|
|
64
|
-
})
|
|
65
|
-
.extend(transactionQueue())
|
|
66
|
-
.extend(writeObserver({ onWrite: (write) => write$.next(write) }));
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
* Create an object for communicating with the deployed World.
|
|
70
|
-
*/
|
|
71
|
-
const worldContract = getContract({
|
|
72
|
-
address: networkConfig.worldAddress as Hex,
|
|
73
|
-
abi: IWorldAbi,
|
|
74
|
-
client: { public: publicClient, wallet: burnerWalletClient },
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* Sync on-chain state into RECS and keeps our client in sync.
|
|
79
|
-
* Uses the MUD indexer if available, otherwise falls back
|
|
80
|
-
* to the viem publicClient to make RPC calls to fetch MUD
|
|
81
|
-
* events from the chain.
|
|
82
|
-
*/
|
|
83
|
-
const { tables, useStore, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToZustand({
|
|
84
|
-
config: mudConfig,
|
|
85
|
-
address: networkConfig.worldAddress as Hex,
|
|
86
|
-
publicClient,
|
|
87
|
-
startBlock: BigInt(networkConfig.initialBlockNumber),
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
tables,
|
|
92
|
-
useStore,
|
|
93
|
-
publicClient,
|
|
94
|
-
walletClient: burnerWalletClient,
|
|
95
|
-
latestBlock$,
|
|
96
|
-
storedBlockLogs$,
|
|
97
|
-
waitForTransaction,
|
|
98
|
-
worldContract,
|
|
99
|
-
write$: write$.asObservable().pipe(share()),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineWorld } from "@latticexyz/world";
|
|
2
|
-
|
|
3
|
-
export default defineWorld({
|
|
4
|
-
namespace: "app",
|
|
5
|
-
tables: {
|
|
6
|
-
Tasks: {
|
|
7
|
-
schema: {
|
|
8
|
-
id: "bytes32",
|
|
9
|
-
createdAt: "uint256",
|
|
10
|
-
completedAt: "uint256",
|
|
11
|
-
description: "string",
|
|
12
|
-
},
|
|
13
|
-
key: ["id"],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|