create-mud 2.2.17-f52b1476f04ce0be68691e3b021a81e0fb9cce99 → 2.2.17-f88e48e47ceb4a29a3862a3f3b85891490952f0e
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 +4 -2
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2 -9
- package/dist/cli.js.map +1 -1
- package/{templates → dist/templates}/react/packages/client/src/mud/Synced.tsx +1 -1
- package/{templates → dist/templates}/react/packages/contracts/mud.config.ts +7 -0
- package/{templates → dist/templates}/react/packages/contracts/test/MoveTest.t.sol +2 -0
- package/{templates/react-ecs → dist/templates/react}/packages/contracts/test/WorldTest.t.sol +5 -0
- package/{templates/react → dist/templates/react-ecs}/package.json +2 -1
- package/{templates → dist/templates}/react-ecs/packages/client/package.json +9 -16
- package/dist/templates/react-ecs/packages/client/src/App.tsx +29 -0
- package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +51 -0
- package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +77 -0
- package/{templates/react → dist/templates/threejs}/packages/client/index.html +2 -2
- package/dist/templates/threejs/packages/client/src/MUDContext.tsx +21 -0
- package/dist/templates/threejs/packages/client/src/index.tsx +34 -0
- package/{templates/react → dist/templates/threejs}/packages/client/vite.config.ts +7 -2
- package/{templates/react-ecs → dist/templates/threejs}/packages/contracts/.env +1 -1
- package/dist/templates/vanilla/gitignore +7 -0
- package/dist/templates/vanilla/mprocs.yaml +13 -0
- package/dist/templates/vanilla/packages/client/gitignore +3 -0
- package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +21 -0
- package/dist/templates/vanilla/packages/client/src/mud/setup.ts +21 -0
- package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +106 -0
- package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +20 -0
- package/dist/templates/vanilla/packages/client/src/mud/world.ts +3 -0
- package/{templates/react → dist/templates/vanilla}/packages/client/tsconfig.json +1 -1
- package/dist/templates/vanilla/packages/contracts/.env +11 -0
- package/dist/templates/vanilla/packages/contracts/gitignore +9 -0
- package/dist/templates/vanilla/packages/contracts/mud.config.ts +13 -0
- package/{templates/react → dist/templates/vanilla}/packages/contracts/package.json +0 -1
- package/{templates/react → dist/templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +5 -1
- package/{templates/react/packages/contracts/src/codegen/common.sol → dist/templates/vanilla/packages/contracts/src/codegen/index.sol} +1 -6
- package/{templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol → dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol} +35 -35
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +13 -0
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +16 -0
- package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +14 -0
- package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +31 -0
- package/dist/templates/vanilla/packages/contracts/worlds.json +5 -0
- package/package.json +11 -17
- package/bin/cli.js +0 -4
- package/templates/react/.gitignore_ +0 -16
- package/templates/react/mprocs.yaml +0 -21
- package/templates/react/packages/client/.gitignore_ +0 -1
- package/templates/react/packages/client/postcss.config.cjs +0 -6
- package/templates/react/packages/client/src/game/useKeyboardMovement.ts +0 -26
- package/templates/react/packages/client/src/index.tsx +0 -19
- package/templates/react/packages/client/src/mud/Explorer.tsx +0 -32
- package/templates/react/packages/client/src/mud/useWorldContract.ts +0 -44
- package/templates/react/packages/client/src/ui/AsyncButton.tsx +0 -41
- package/templates/react/packages/client/src/ui/ErrorFallback.tsx +0 -58
- package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -22
- package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +0 -25
- package/templates/react/packages/client/src/wagmiConfig.ts +0 -49
- package/templates/react/packages/client/tailwind.config.ts +0 -10
- package/templates/react/packages/contracts/.env +0 -11
- package/templates/react/packages/contracts/.gitignore_ +0 -13
- package/templates/react/packages/contracts/test/WorldTest.t.sol +0 -16
- package/templates/react/packages/contracts/worlds.json +0 -5
- package/templates/react-ecs/packages/client/src/App.tsx +0 -74
- package/templates/react-ecs/packages/client/src/Providers.tsx +0 -29
- package/templates/react-ecs/packages/client/src/common.ts +0 -27
- package/templates/react-ecs/packages/client/src/game/GameMap.tsx +0 -112
- package/templates/react-ecs/packages/client/src/mud/Synced.tsx +0 -14
- package/templates/react-ecs/packages/client/src/mud/recs.ts +0 -6
- package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +0 -17
- package/templates/react-ecs/packages/contracts/mud.config.ts +0 -18
- package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -2039
- package/templates/react-ecs/packages/contracts/src/Entity.sol +0 -20
- package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +0 -30
- package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +0 -18
- package/templates/react-ecs/packages/contracts/src/codegen/index.sol +0 -8
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +0 -202
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +0 -321
- package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -16
- package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +0 -15
- package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +0 -17
- package/templates/react-ecs/packages/contracts/src/createEntity.sol +0 -11
- package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +0 -39
- /package/{templates → dist/templates}/phaser/.eslintrc +0 -0
- /package/{templates → dist/templates}/phaser/.gitattributes +0 -0
- /package/{templates → dist/templates}/phaser/.vscode/extensions.json +0 -0
- /package/{templates → dist/templates}/phaser/.vscode/settings.json +0 -0
- /package/{templates/phaser/.gitignore_ → dist/templates/phaser/gitignore} +0 -0
- /package/{templates → dist/templates}/phaser/mprocs.yaml +0 -0
- /package/{templates → dist/templates}/phaser/package.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/README.md +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/config-sprites.json +0 -0
- /package/{templates/phaser/packages/art/.gitignore_ → dist/templates/phaser/packages/art/gitignore} +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/package.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/scripts/cli.mjs +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/tilesets/images/world.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/art/tilesets/world.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/.env +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/.eslintrc +0 -0
- /package/{templates/phaser/packages/client/.gitignore_ → dist/templates/phaser/packages/client/gitignore} +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/index.html +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/package.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/index.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/setup.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/mud/world.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/store.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/App.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/tsconfig.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/client/vite.config.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/.env +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/.prettierrc +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/.solhint.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/foundry.toml +0 -0
- /package/{templates/phaser/packages/contracts/.gitignore_ → dist/templates/phaser/packages/contracts/gitignore} +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/mud.config.ts +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/package.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/remappings.txt +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/tsconfig.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/worlds.json +0 -0
- /package/{templates → dist/templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
- /package/{templates → dist/templates}/phaser/pnpm-workspace.yaml +0 -0
- /package/{templates → dist/templates}/phaser/tsconfig.json +0 -0
- /package/{templates → dist/templates}/react/.eslintrc +0 -0
- /package/{templates → dist/templates}/react/.gitattributes +0 -0
- /package/{templates → dist/templates}/react/.vscode/extensions.json +0 -0
- /package/{templates → dist/templates}/react/.vscode/settings.json +0 -0
- /package/{templates/react-ecs/.gitignore_ → dist/templates/react/gitignore} +0 -0
- /package/{templates/react-ecs → dist/templates/react}/mprocs.yaml +0 -0
- /package/{templates/react-ecs → dist/templates/react}/package.json +0 -0
- /package/{templates → dist/templates}/react/packages/client/.env +0 -0
- /package/{templates → dist/templates}/react/packages/client/.eslintrc +0 -0
- /package/{templates/react-ecs/packages/client/.gitignore_ → dist/templates/react/packages/client/gitignore} +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/index.html +0 -0
- /package/{templates → dist/templates}/react/packages/client/package.json +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/postcss.config.cjs +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/App.tsx +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/Providers.tsx +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/common.ts +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/game/GameMap.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/game/useKeyboardMovement.ts +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/index.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/mud/Explorer.tsx +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/mud/stash.ts +0 -0
- /package/{templates → dist/templates}/react/packages/client/src/mud/useSyncStatus.ts +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/mud/useWorldContract.ts +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/AsyncButton.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/ErrorFallback.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/icons/MUDIcon.tsx +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/src/wagmiConfig.ts +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/tailwind.config.ts +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/tsconfig.json +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/client/vite.config.ts +0 -0
- /package/{templates/vanilla → dist/templates/react}/packages/contracts/.env +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/.prettierrc +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/.solhint.json +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/foundry.toml +0 -0
- /package/{templates/react-ecs/packages/contracts/.gitignore_ → dist/templates/react/packages/contracts/gitignore} +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/contracts/package.json +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/remappings.txt +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/src/MoveSystem.sol +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/contracts/src/codegen/common.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/src/codegen/index.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/tsconfig.json +0 -0
- /package/{templates/react-ecs → dist/templates/react}/packages/contracts/worlds.json +0 -0
- /package/{templates → dist/templates}/react/packages/contracts/worlds.json.d.ts +0 -0
- /package/{templates → dist/templates}/react/pnpm-workspace.yaml +0 -0
- /package/{templates → dist/templates}/react/tsconfig.json +0 -0
- /package/{templates → dist/templates}/react-ecs/.eslintrc +0 -0
- /package/{templates → dist/templates}/react-ecs/.gitattributes +0 -0
- /package/{templates → dist/templates}/react-ecs/.vscode/extensions.json +0 -0
- /package/{templates → dist/templates}/react-ecs/.vscode/settings.json +0 -0
- /package/{templates/threejs/.gitignore_ → dist/templates/react-ecs/gitignore} +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/mprocs.yaml +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/client/.env +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/client/.eslintrc +0 -0
- /package/{templates/threejs/packages/client/.gitignore_ → dist/templates/react-ecs/packages/client/gitignore} +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/index.html +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/MUDContext.tsx +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/index.tsx +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/client/src/mud/setup.ts +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/world.ts +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/tsconfig.json +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/client/vite.config.ts +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/contracts/.env +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/.prettierrc +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/.solhint.json +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/foundry.toml +0 -0
- /package/{templates/threejs/packages/contracts/.gitignore_ → dist/templates/react-ecs/packages/contracts/gitignore} +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/mud.config.ts +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/package.json +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/remappings.txt +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/index.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
- /package/{templates/threejs → dist/templates/react-ecs}/packages/contracts/worlds.json +0 -0
- /package/{templates → dist/templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{templates → dist/templates}/react-ecs/pnpm-workspace.yaml +0 -0
- /package/{templates → dist/templates}/react-ecs/tsconfig.json +0 -0
- /package/{templates → dist/templates}/threejs/.eslintrc +0 -0
- /package/{templates → dist/templates}/threejs/.gitattributes +0 -0
- /package/{templates → dist/templates}/threejs/.vscode/extensions.json +0 -0
- /package/{templates → dist/templates}/threejs/.vscode/settings.json +0 -0
- /package/{templates/vanilla/.gitignore_ → dist/templates/threejs/gitignore} +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/mprocs.yaml +0 -0
- /package/{templates → dist/templates}/threejs/package.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/.env +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/.eslintrc +0 -0
- /package/{templates/vanilla/packages/client/.gitignore_ → dist/templates/threejs/packages/client/gitignore} +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/package.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/App.tsx +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/mud/setup.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/world.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/packages/client/tsconfig.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/.prettierrc +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/.solhint.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/foundry.toml +0 -0
- /package/{templates/vanilla/packages/contracts/.gitignore_ → dist/templates/threejs/packages/contracts/gitignore} +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/mud.config.ts +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/package.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/remappings.txt +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/index.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/tsconfig.json +0 -0
- /package/{templates/vanilla → dist/templates/threejs}/packages/contracts/worlds.json +0 -0
- /package/{templates → dist/templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{templates → dist/templates}/threejs/pnpm-workspace.yaml +0 -0
- /package/{templates → dist/templates}/threejs/tsconfig.json +0 -0
- /package/{templates → dist/templates}/vanilla/.eslintrc +0 -0
- /package/{templates → dist/templates}/vanilla/.gitattributes +0 -0
- /package/{templates → dist/templates}/vanilla/.vscode/extensions.json +0 -0
- /package/{templates → dist/templates}/vanilla/.vscode/settings.json +0 -0
- /package/{templates → dist/templates}/vanilla/package.json +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/.env +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/index.html +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/package.json +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/src/index.ts +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{templates → dist/templates}/vanilla/packages/client/vite.config.ts +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/.prettierrc +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/.solhint.json +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/foundry.toml +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/remappings.txt +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/tsconfig.json +0 -0
- /package/{templates → dist/templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
- /package/{templates → dist/templates}/vanilla/pnpm-workspace.yaml +0 -0
- /package/{templates → dist/templates}/vanilla/tsconfig.json +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The supported chains.
|
|
3
|
+
* By default, there are only two chains here:
|
|
4
|
+
*
|
|
5
|
+
* - mudFoundry, the chain running on anvil that pnpm dev
|
|
6
|
+
* starts by default. It is similar to the viem anvil chain
|
|
7
|
+
* (see https://viem.sh/docs/clients/test.html), but with the
|
|
8
|
+
* basefee set to zero to avoid transaction fees.
|
|
9
|
+
* - Redstone, our production blockchain (https://redstone.xyz/)
|
|
10
|
+
* - Garnet, our test blockchain (https://garnetchain.com/))
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { MUDChain, mudFoundry, redstone, garnet } from "@latticexyz/common/chains";
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* See https://mud.dev/guides/hello-world/add-chain-client
|
|
18
|
+
* for instructions on how to add networks.
|
|
19
|
+
*/
|
|
20
|
+
export const supportedChains: MUDChain[] = [mudFoundry, redstone, garnet];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This .env file is for demonstration purposes only.
|
|
2
|
+
#
|
|
3
|
+
# This should usually be excluded via .gitignore and the env vars attached to
|
|
4
|
+
# your deployment environment, but we're including this here for ease of local
|
|
5
|
+
# development. Please do not commit changes to this file!
|
|
6
|
+
#
|
|
7
|
+
# Enable debug logs for MUD CLI
|
|
8
|
+
DEBUG=mud:*
|
|
9
|
+
#
|
|
10
|
+
# Anvil default private key:
|
|
11
|
+
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
package/{templates/react → dist/templates/vanilla}/packages/contracts/script/PostDeploy.s.sol
RENAMED
|
@@ -18,7 +18,11 @@ contract PostDeploy is Script {
|
|
|
18
18
|
// Start broadcasting transactions from the deployer account
|
|
19
19
|
vm.startBroadcast(deployerPrivateKey);
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// ------------------ EXAMPLES ------------------
|
|
22
|
+
|
|
23
|
+
// Call increment on the world via the registered function selector
|
|
24
|
+
uint32 newValue = IWorld(worldAddress).app__increment();
|
|
25
|
+
console.log("Increment via IWorld:", newValue);
|
|
22
26
|
|
|
23
27
|
vm.stopBroadcast();
|
|
24
28
|
}
|
|
@@ -16,17 +16,17 @@ import { Schema } from "@latticexyz/store/src/Schema.sol";
|
|
|
16
16
|
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
18
18
|
|
|
19
|
-
library
|
|
20
|
-
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "
|
|
21
|
-
ResourceId constant _tableId = ResourceId.wrap(
|
|
19
|
+
library Counter {
|
|
20
|
+
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "Counter", typeId: RESOURCE_TABLE });`
|
|
21
|
+
ResourceId constant _tableId = ResourceId.wrap(0x74626170700000000000000000000000436f756e746572000000000000000000);
|
|
22
22
|
|
|
23
23
|
FieldLayout constant _fieldLayout =
|
|
24
|
-
FieldLayout.wrap(
|
|
24
|
+
FieldLayout.wrap(0x0004010004000000000000000000000000000000000000000000000000000000);
|
|
25
25
|
|
|
26
26
|
// Hex-encoded key schema of ()
|
|
27
27
|
Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000);
|
|
28
|
-
// Hex-encoded value schema of (
|
|
29
|
-
Schema constant _valueSchema = Schema.wrap(
|
|
28
|
+
// Hex-encoded value schema of (uint32)
|
|
29
|
+
Schema constant _valueSchema = Schema.wrap(0x0004010003000000000000000000000000000000000000000000000000000000);
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @notice Get the table's key field names.
|
|
@@ -42,7 +42,7 @@ library EntityCount {
|
|
|
42
42
|
*/
|
|
43
43
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
|
44
44
|
fieldNames = new string[](1);
|
|
45
|
-
fieldNames[0] = "
|
|
45
|
+
fieldNames[0] = "value";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -60,79 +60,79 @@ library EntityCount {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @notice Get
|
|
63
|
+
* @notice Get value.
|
|
64
64
|
*/
|
|
65
|
-
function
|
|
65
|
+
function getValue() internal view returns (uint32 value) {
|
|
66
66
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
67
67
|
|
|
68
68
|
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
69
|
-
return (
|
|
69
|
+
return (uint32(bytes4(_blob)));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* @notice Get
|
|
73
|
+
* @notice Get value.
|
|
74
74
|
*/
|
|
75
|
-
function
|
|
75
|
+
function _getValue() internal view returns (uint32 value) {
|
|
76
76
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
77
77
|
|
|
78
78
|
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
79
|
-
return (
|
|
79
|
+
return (uint32(bytes4(_blob)));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* @notice Get
|
|
83
|
+
* @notice Get value.
|
|
84
84
|
*/
|
|
85
|
-
function get() internal view returns (
|
|
85
|
+
function get() internal view returns (uint32 value) {
|
|
86
86
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
87
87
|
|
|
88
88
|
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
89
|
-
return (
|
|
89
|
+
return (uint32(bytes4(_blob)));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* @notice Get
|
|
93
|
+
* @notice Get value.
|
|
94
94
|
*/
|
|
95
|
-
function _get() internal view returns (
|
|
95
|
+
function _get() internal view returns (uint32 value) {
|
|
96
96
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
97
97
|
|
|
98
98
|
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
99
|
-
return (
|
|
99
|
+
return (uint32(bytes4(_blob)));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* @notice Set
|
|
103
|
+
* @notice Set value.
|
|
104
104
|
*/
|
|
105
|
-
function
|
|
105
|
+
function setValue(uint32 value) internal {
|
|
106
106
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
107
107
|
|
|
108
|
-
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
108
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* @notice Set
|
|
112
|
+
* @notice Set value.
|
|
113
113
|
*/
|
|
114
|
-
function
|
|
114
|
+
function _setValue(uint32 value) internal {
|
|
115
115
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
116
116
|
|
|
117
|
-
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
117
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* @notice Set
|
|
121
|
+
* @notice Set value.
|
|
122
122
|
*/
|
|
123
|
-
function set(
|
|
123
|
+
function set(uint32 value) internal {
|
|
124
124
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
125
125
|
|
|
126
|
-
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
126
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* @notice Set
|
|
130
|
+
* @notice Set value.
|
|
131
131
|
*/
|
|
132
|
-
function _set(
|
|
132
|
+
function _set(uint32 value) internal {
|
|
133
133
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
134
134
|
|
|
135
|
-
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
135
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
@@ -157,8 +157,8 @@ library EntityCount {
|
|
|
157
157
|
* @notice Tightly pack static (fixed length) data using this table's schema.
|
|
158
158
|
* @return The static data, encoded into a sequence of bytes.
|
|
159
159
|
*/
|
|
160
|
-
function encodeStatic(
|
|
161
|
-
return abi.encodePacked(
|
|
160
|
+
function encodeStatic(uint32 value) internal pure returns (bytes memory) {
|
|
161
|
+
return abi.encodePacked(value);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -167,8 +167,8 @@ library EntityCount {
|
|
|
167
167
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
|
168
168
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
|
169
169
|
*/
|
|
170
|
-
function encode(
|
|
171
|
-
bytes memory _staticData = encodeStatic(
|
|
170
|
+
function encode(uint32 value) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
|
171
|
+
bytes memory _staticData = encodeStatic(value);
|
|
172
172
|
|
|
173
173
|
EncodedLengths _encodedLengths;
|
|
174
174
|
bytes memory _dynamicData;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @title IIncrementSystem
|
|
8
|
+
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
|
9
|
+
* @dev This interface is automatically generated from the corresponding system contract. Do not edit manually.
|
|
10
|
+
*/
|
|
11
|
+
interface IIncrementSystem {
|
|
12
|
+
function app__increment() external returns (uint32);
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
|
7
|
+
import { IIncrementSystem } from "./IIncrementSystem.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @title IWorld
|
|
11
|
+
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
|
|
12
|
+
* @notice This interface integrates all systems and associated function selectors
|
|
13
|
+
* that are dynamically registered in the World during deployment.
|
|
14
|
+
* @dev This is an autogenerated file; do not edit manually.
|
|
15
|
+
*/
|
|
16
|
+
interface IWorld is IBaseWorld, IIncrementSystem {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
import { System } from "@latticexyz/world/src/System.sol";
|
|
5
|
+
import { Counter } from "../codegen/index.sol";
|
|
6
|
+
|
|
7
|
+
contract IncrementSystem is System {
|
|
8
|
+
function increment() public returns (uint32) {
|
|
9
|
+
uint32 counter = Counter.get();
|
|
10
|
+
uint32 newValue = counter + 1;
|
|
11
|
+
Counter.set(newValue);
|
|
12
|
+
return newValue;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
import "forge-std/Test.sol";
|
|
5
|
+
import { MudTest } from "@latticexyz/world/test/MudTest.t.sol";
|
|
6
|
+
import { getKeysWithValue } from "@latticexyz/world-modules/src/modules/keyswithvalue/getKeysWithValue.sol";
|
|
7
|
+
|
|
8
|
+
import { IWorld } from "../src/codegen/world/IWorld.sol";
|
|
9
|
+
import { Counter } from "../src/codegen/index.sol";
|
|
10
|
+
|
|
11
|
+
contract CounterTest is MudTest {
|
|
12
|
+
function testWorldExists() public {
|
|
13
|
+
uint256 codeSize;
|
|
14
|
+
address addr = worldAddress;
|
|
15
|
+
assembly {
|
|
16
|
+
codeSize := extcodesize(addr)
|
|
17
|
+
}
|
|
18
|
+
assertTrue(codeSize > 0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function testCounter() public {
|
|
22
|
+
// Expect the counter to be 1 because it was incremented in the PostDeploy script.
|
|
23
|
+
uint32 counter = Counter.get();
|
|
24
|
+
assertEq(counter, 1);
|
|
25
|
+
|
|
26
|
+
// Expect the counter to be 2 after calling increment.
|
|
27
|
+
IWorld(worldAddress).app__increment();
|
|
28
|
+
counter = Counter.get();
|
|
29
|
+
assertEq(counter, 2);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mud",
|
|
3
|
-
"version": "2.2.17-
|
|
3
|
+
"version": "2.2.17-f88e48e47ceb4a29a3862a3f3b85891490952f0e",
|
|
4
4
|
"description": "Create a new MUD project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lattice <mud@lattice.xyz>",
|
|
7
|
-
"
|
|
8
|
-
"bin": "bin/cli.js",
|
|
7
|
+
"bin": "dist/cli.js",
|
|
9
8
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"dist",
|
|
12
|
-
"templates"
|
|
9
|
+
"dist"
|
|
13
10
|
],
|
|
14
11
|
"dependencies": {
|
|
15
|
-
"
|
|
16
|
-
"yargs-interactive": "^3.0.1"
|
|
12
|
+
"create-create-app": "git+https://github.com/holic/create-create-app#74376c59b48a04aabbe94d9cacfe9cb1cecccd63"
|
|
17
13
|
},
|
|
18
14
|
"devDependencies": {
|
|
19
|
-
"@types/yargs-interactive": "^2.1.6",
|
|
20
15
|
"execa": "^7.0.0"
|
|
21
16
|
},
|
|
22
17
|
"publishConfig": {
|
|
@@ -25,17 +20,16 @@
|
|
|
25
20
|
},
|
|
26
21
|
"scripts": {
|
|
27
22
|
"build": "pnpm run build:js",
|
|
28
|
-
"build:js": "tsup &&
|
|
23
|
+
"build:js": "tsup && tsx ./scripts/copy-templates.ts",
|
|
29
24
|
"clean": "pnpm run clean:js",
|
|
30
25
|
"clean:js": "shx rm -rf dist",
|
|
31
|
-
"copy-templates": "tsx ./scripts/copy-templates.ts",
|
|
32
26
|
"dev": "tsup --watch",
|
|
33
|
-
"test": "pnpm run
|
|
27
|
+
"test": "pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs",
|
|
34
28
|
"test:ci": "pnpm run test",
|
|
35
|
-
"test:phaser": "
|
|
36
|
-
"test:react": "
|
|
37
|
-
"test:react-ecs": "
|
|
38
|
-
"test:threejs": "
|
|
39
|
-
"test:vanilla": "
|
|
29
|
+
"test:phaser": "dist/cli.js test-project --template phaser && shx rm -rf test-project",
|
|
30
|
+
"test:react": "dist/cli.js test-project --template react && shx rm -rf test-project",
|
|
31
|
+
"test:react-ecs": "dist/cli.js test-project --template react-ecs && shx rm -rf test-project",
|
|
32
|
+
"test:threejs": "dist/cli.js test-project --template threejs && shx rm -rf test-project",
|
|
33
|
+
"test:vanilla": "dist/cli.js test-project --template vanilla && shx rm -rf test-project"
|
|
40
34
|
}
|
|
41
35
|
}
|
package/bin/cli.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
scrollback: 10000
|
|
2
|
-
procs:
|
|
3
|
-
client:
|
|
4
|
-
cwd: packages/client
|
|
5
|
-
shell: pnpm run dev
|
|
6
|
-
contracts:
|
|
7
|
-
cwd: packages/contracts
|
|
8
|
-
shell: pnpm mud dev-contracts --rpc http://127.0.0.1:8545
|
|
9
|
-
deploy-prereqs:
|
|
10
|
-
cwd: packages/contracts
|
|
11
|
-
shell: pnpm deploy-local-prereqs
|
|
12
|
-
env:
|
|
13
|
-
DEBUG: "mud:*"
|
|
14
|
-
# Anvil default account (0x70997970C51812dc3A010C7d01b50e0d17dc79C8)
|
|
15
|
-
PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
16
|
-
anvil:
|
|
17
|
-
cwd: packages/contracts
|
|
18
|
-
shell: anvil --block-time 2
|
|
19
|
-
explorer:
|
|
20
|
-
cwd: packages/contracts
|
|
21
|
-
shell: pnpm explorer
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dist
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { Direction } from "../common";
|
|
3
|
-
|
|
4
|
-
const keys = new Map<KeyboardEvent["key"], Direction>([
|
|
5
|
-
["ArrowUp", "North"],
|
|
6
|
-
["ArrowRight", "East"],
|
|
7
|
-
["ArrowDown", "South"],
|
|
8
|
-
["ArrowLeft", "West"],
|
|
9
|
-
]);
|
|
10
|
-
|
|
11
|
-
export const useKeyboardMovement = (move: undefined | ((direction: Direction) => void)) => {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (!move) return;
|
|
14
|
-
|
|
15
|
-
const listener = (event: KeyboardEvent) => {
|
|
16
|
-
const direction = keys.get(event.key);
|
|
17
|
-
if (direction == null) return;
|
|
18
|
-
|
|
19
|
-
event.preventDefault();
|
|
20
|
-
move(direction);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
window.addEventListener("keydown", listener);
|
|
24
|
-
return () => window.removeEventListener("keydown", listener);
|
|
25
|
-
}, [move]);
|
|
26
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "tailwindcss/tailwind.css";
|
|
2
|
-
import { StrictMode } from "react";
|
|
3
|
-
import { createRoot } from "react-dom/client";
|
|
4
|
-
import { Providers } from "./Providers";
|
|
5
|
-
import { App } from "./App";
|
|
6
|
-
import { Explorer } from "./mud/Explorer";
|
|
7
|
-
import { ErrorBoundary } from "react-error-boundary";
|
|
8
|
-
import { ErrorFallback } from "./ui/ErrorFallback";
|
|
9
|
-
|
|
10
|
-
createRoot(document.getElementById("react-root")!).render(
|
|
11
|
-
<StrictMode>
|
|
12
|
-
<ErrorBoundary FallbackComponent={ErrorFallback}>
|
|
13
|
-
<Providers>
|
|
14
|
-
<App />
|
|
15
|
-
<Explorer />
|
|
16
|
-
</Providers>
|
|
17
|
-
</ErrorBoundary>
|
|
18
|
-
</StrictMode>,
|
|
19
|
-
);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { getChain, getWorldAddress } from "../common";
|
|
3
|
-
import { MUDIcon } from "../ui/icons/MUDIcon";
|
|
4
|
-
|
|
5
|
-
export function Explorer() {
|
|
6
|
-
const [open, setOpen] = useState(false);
|
|
7
|
-
|
|
8
|
-
const chain = getChain();
|
|
9
|
-
const worldAddress = getWorldAddress();
|
|
10
|
-
|
|
11
|
-
const explorerUrl = chain.blockExplorers?.worldsExplorer?.url;
|
|
12
|
-
if (!explorerUrl) return null;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className="fixed bottom-0 inset-x-0 flex flex-col opacity-80 transition hover:opacity-100">
|
|
16
|
-
<button
|
|
17
|
-
type="button"
|
|
18
|
-
onClick={() => setOpen(!open)}
|
|
19
|
-
className="outline-none flex justify-end gap-2 p-2 font-medium leading-none text-black"
|
|
20
|
-
>
|
|
21
|
-
{open ? (
|
|
22
|
-
<>Close</>
|
|
23
|
-
) : (
|
|
24
|
-
<>
|
|
25
|
-
Explore <MUDIcon className="text-orange-500" />
|
|
26
|
-
</>
|
|
27
|
-
)}
|
|
28
|
-
</button>
|
|
29
|
-
{open ? <iframe src={`${explorerUrl}/${worldAddress}`} className="bg-black h-[50vh]" /> : null}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useClient } from "wagmi";
|
|
2
|
-
import { chainId, getWorldAddress } from "../common";
|
|
3
|
-
import { Account, Chain, Client, GetContractReturnType, Transport, getContract } from "viem";
|
|
4
|
-
import { useQuery } from "@tanstack/react-query";
|
|
5
|
-
import { useSessionClient } from "@latticexyz/entrykit/internal";
|
|
6
|
-
import { observer } from "@latticexyz/explorer/observer";
|
|
7
|
-
import worldAbi from "contracts/out/IWorld.sol/IWorld.abi.json";
|
|
8
|
-
|
|
9
|
-
export function useWorldContract():
|
|
10
|
-
| GetContractReturnType<
|
|
11
|
-
typeof worldAbi,
|
|
12
|
-
{
|
|
13
|
-
public: Client<Transport, Chain>;
|
|
14
|
-
wallet: Client<Transport, Chain, Account>;
|
|
15
|
-
}
|
|
16
|
-
>
|
|
17
|
-
| undefined {
|
|
18
|
-
const client = useClient({ chainId });
|
|
19
|
-
const { data: sessionClient } = useSessionClient();
|
|
20
|
-
|
|
21
|
-
const { data: worldContract } = useQuery({
|
|
22
|
-
queryKey: ["worldContract", client?.uid, sessionClient?.uid],
|
|
23
|
-
queryFn: () => {
|
|
24
|
-
if (!client || !sessionClient) {
|
|
25
|
-
throw new Error("Not connected.");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return getContract({
|
|
29
|
-
abi: worldAbi,
|
|
30
|
-
address: getWorldAddress(),
|
|
31
|
-
client: {
|
|
32
|
-
public: client,
|
|
33
|
-
wallet: sessionClient.extend(observer()),
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
staleTime: Infinity,
|
|
38
|
-
refetchOnMount: false,
|
|
39
|
-
refetchOnReconnect: false,
|
|
40
|
-
refetchOnWindowFocus: false,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return worldContract;
|
|
44
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DetailedHTMLProps, ButtonHTMLAttributes, useState, useRef, useCallback, MouseEventHandler } from "react";
|
|
2
|
-
|
|
3
|
-
export type AsyncButtonProps = {
|
|
4
|
-
pending?: boolean;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type Props = AsyncButtonProps & DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
8
|
-
|
|
9
|
-
export const AsyncButton = ({ pending, type, disabled, onClick, ...props }: Props) => {
|
|
10
|
-
// TODO: move all this logic into a hook so we can wrap other event handlers
|
|
11
|
-
|
|
12
|
-
const promiseRef = useRef<Promise<unknown>>();
|
|
13
|
-
const [promisePending, setPromisePending] = useState<true | undefined>(undefined);
|
|
14
|
-
|
|
15
|
-
const asyncOnClick = useCallback<MouseEventHandler<HTMLButtonElement>>(
|
|
16
|
-
(...args) => {
|
|
17
|
-
if (!onClick) return;
|
|
18
|
-
const result = onClick(...args);
|
|
19
|
-
const promise = Promise.resolve(result);
|
|
20
|
-
promiseRef.current = promise;
|
|
21
|
-
setPromisePending(true);
|
|
22
|
-
promise.finally(() => {
|
|
23
|
-
if (promiseRef.current === promise) {
|
|
24
|
-
setPromisePending(undefined);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
[onClick],
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<button
|
|
33
|
-
type={type || "button"}
|
|
34
|
-
aria-busy={pending || promisePending}
|
|
35
|
-
aria-disabled={disabled}
|
|
36
|
-
disabled={disabled || pending || promisePending}
|
|
37
|
-
onClick={onClick ? asyncOnClick : undefined}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|