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.
Files changed (317) hide show
  1. package/README.md +4 -2
  2. package/dist/cli.d.ts +1 -2
  3. package/dist/cli.js +2 -9
  4. package/dist/cli.js.map +1 -1
  5. package/{templates → dist/templates}/react/packages/client/src/mud/Synced.tsx +1 -1
  6. package/{templates → dist/templates}/react/packages/contracts/mud.config.ts +7 -0
  7. package/{templates → dist/templates}/react/packages/contracts/test/MoveTest.t.sol +2 -0
  8. package/{templates/react-ecs → dist/templates/react}/packages/contracts/test/WorldTest.t.sol +5 -0
  9. package/{templates/react → dist/templates/react-ecs}/package.json +2 -1
  10. package/{templates → dist/templates}/react-ecs/packages/client/package.json +9 -16
  11. package/dist/templates/react-ecs/packages/client/src/App.tsx +29 -0
  12. package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +51 -0
  13. package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +77 -0
  14. package/{templates/react → dist/templates/threejs}/packages/client/index.html +2 -2
  15. package/dist/templates/threejs/packages/client/src/MUDContext.tsx +21 -0
  16. package/dist/templates/threejs/packages/client/src/index.tsx +34 -0
  17. package/{templates/react → dist/templates/threejs}/packages/client/vite.config.ts +7 -2
  18. package/{templates/react-ecs → dist/templates/threejs}/packages/contracts/.env +1 -1
  19. package/dist/templates/vanilla/gitignore +7 -0
  20. package/dist/templates/vanilla/mprocs.yaml +13 -0
  21. package/dist/templates/vanilla/packages/client/gitignore +3 -0
  22. package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +21 -0
  23. package/dist/templates/vanilla/packages/client/src/mud/setup.ts +21 -0
  24. package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +106 -0
  25. package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +20 -0
  26. package/dist/templates/vanilla/packages/client/src/mud/world.ts +3 -0
  27. package/{templates/react → dist/templates/vanilla}/packages/client/tsconfig.json +1 -1
  28. package/dist/templates/vanilla/packages/contracts/.env +11 -0
  29. package/dist/templates/vanilla/packages/contracts/gitignore +9 -0
  30. package/dist/templates/vanilla/packages/contracts/mud.config.ts +13 -0
  31. package/{templates/react → dist/templates/vanilla}/packages/contracts/package.json +0 -1
  32. package/{templates/react → dist/templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +5 -1
  33. package/{templates/react/packages/contracts/src/codegen/common.sol → dist/templates/vanilla/packages/contracts/src/codegen/index.sol} +1 -6
  34. package/{templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol → dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol} +35 -35
  35. package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +13 -0
  36. package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +16 -0
  37. package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +14 -0
  38. package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +31 -0
  39. package/dist/templates/vanilla/packages/contracts/worlds.json +5 -0
  40. package/package.json +11 -17
  41. package/bin/cli.js +0 -4
  42. package/templates/react/.gitignore_ +0 -16
  43. package/templates/react/mprocs.yaml +0 -21
  44. package/templates/react/packages/client/.gitignore_ +0 -1
  45. package/templates/react/packages/client/postcss.config.cjs +0 -6
  46. package/templates/react/packages/client/src/game/useKeyboardMovement.ts +0 -26
  47. package/templates/react/packages/client/src/index.tsx +0 -19
  48. package/templates/react/packages/client/src/mud/Explorer.tsx +0 -32
  49. package/templates/react/packages/client/src/mud/useWorldContract.ts +0 -44
  50. package/templates/react/packages/client/src/ui/AsyncButton.tsx +0 -41
  51. package/templates/react/packages/client/src/ui/ErrorFallback.tsx +0 -58
  52. package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -22
  53. package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +0 -25
  54. package/templates/react/packages/client/src/wagmiConfig.ts +0 -49
  55. package/templates/react/packages/client/tailwind.config.ts +0 -10
  56. package/templates/react/packages/contracts/.env +0 -11
  57. package/templates/react/packages/contracts/.gitignore_ +0 -13
  58. package/templates/react/packages/contracts/test/WorldTest.t.sol +0 -16
  59. package/templates/react/packages/contracts/worlds.json +0 -5
  60. package/templates/react-ecs/packages/client/src/App.tsx +0 -74
  61. package/templates/react-ecs/packages/client/src/Providers.tsx +0 -29
  62. package/templates/react-ecs/packages/client/src/common.ts +0 -27
  63. package/templates/react-ecs/packages/client/src/game/GameMap.tsx +0 -112
  64. package/templates/react-ecs/packages/client/src/mud/Synced.tsx +0 -14
  65. package/templates/react-ecs/packages/client/src/mud/recs.ts +0 -6
  66. package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +0 -17
  67. package/templates/react-ecs/packages/contracts/mud.config.ts +0 -18
  68. package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -2039
  69. package/templates/react-ecs/packages/contracts/src/Entity.sol +0 -20
  70. package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +0 -30
  71. package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +0 -18
  72. package/templates/react-ecs/packages/contracts/src/codegen/index.sol +0 -8
  73. package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +0 -202
  74. package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +0 -321
  75. package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -16
  76. package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +0 -15
  77. package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +0 -17
  78. package/templates/react-ecs/packages/contracts/src/createEntity.sol +0 -11
  79. package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +0 -39
  80. /package/{templates → dist/templates}/phaser/.eslintrc +0 -0
  81. /package/{templates → dist/templates}/phaser/.gitattributes +0 -0
  82. /package/{templates → dist/templates}/phaser/.vscode/extensions.json +0 -0
  83. /package/{templates → dist/templates}/phaser/.vscode/settings.json +0 -0
  84. /package/{templates/phaser/.gitignore_ → dist/templates/phaser/gitignore} +0 -0
  85. /package/{templates → dist/templates}/phaser/mprocs.yaml +0 -0
  86. /package/{templates → dist/templates}/phaser/package.json +0 -0
  87. /package/{templates → dist/templates}/phaser/packages/art/README.md +0 -0
  88. /package/{templates → dist/templates}/phaser/packages/art/config-sprites.json +0 -0
  89. /package/{templates/phaser/packages/art/.gitignore_ → dist/templates/phaser/packages/art/gitignore} +0 -0
  90. /package/{templates → dist/templates}/phaser/packages/art/package.json +0 -0
  91. /package/{templates → dist/templates}/phaser/packages/art/scripts/cli.mjs +0 -0
  92. /package/{templates → dist/templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
  93. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
  94. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
  95. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
  96. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
  97. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
  98. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
  99. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
  100. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
  101. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
  102. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
  103. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
  104. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
  105. /package/{templates → dist/templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
  106. /package/{templates → dist/templates}/phaser/packages/art/tilesets/images/world.png +0 -0
  107. /package/{templates → dist/templates}/phaser/packages/art/tilesets/world.tsx +0 -0
  108. /package/{templates → dist/templates}/phaser/packages/client/.env +0 -0
  109. /package/{templates → dist/templates}/phaser/packages/client/.eslintrc +0 -0
  110. /package/{templates/phaser/packages/client/.gitignore_ → dist/templates/phaser/packages/client/gitignore} +0 -0
  111. /package/{templates → dist/templates}/phaser/packages/client/index.html +0 -0
  112. /package/{templates → dist/templates}/phaser/packages/client/package.json +0 -0
  113. /package/{templates → dist/templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
  114. /package/{templates → dist/templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
  115. /package/{templates → dist/templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
  116. /package/{templates → dist/templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
  117. /package/{templates → dist/templates}/phaser/packages/client/src/index.tsx +0 -0
  118. /package/{templates → dist/templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
  119. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
  120. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
  121. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
  122. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
  123. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
  124. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
  125. /package/{templates → dist/templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
  126. /package/{templates → dist/templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
  127. /package/{templates → dist/templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
  128. /package/{templates → dist/templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
  129. /package/{templates → dist/templates}/phaser/packages/client/src/mud/setup.ts +0 -0
  130. /package/{templates → dist/templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
  131. /package/{templates → dist/templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
  132. /package/{templates → dist/templates}/phaser/packages/client/src/mud/world.ts +0 -0
  133. /package/{templates → dist/templates}/phaser/packages/client/src/store.ts +0 -0
  134. /package/{templates → dist/templates}/phaser/packages/client/src/ui/App.tsx +0 -0
  135. /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
  136. /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
  137. /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
  138. /package/{templates → dist/templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
  139. /package/{templates → dist/templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
  140. /package/{templates → dist/templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
  141. /package/{templates → dist/templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
  142. /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
  143. /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
  144. /package/{templates → dist/templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
  145. /package/{templates → dist/templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
  146. /package/{templates → dist/templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
  147. /package/{templates → dist/templates}/phaser/packages/client/tsconfig.json +0 -0
  148. /package/{templates → dist/templates}/phaser/packages/client/vite.config.ts +0 -0
  149. /package/{templates → dist/templates}/phaser/packages/contracts/.env +0 -0
  150. /package/{templates → dist/templates}/phaser/packages/contracts/.prettierrc +0 -0
  151. /package/{templates → dist/templates}/phaser/packages/contracts/.solhint.json +0 -0
  152. /package/{templates → dist/templates}/phaser/packages/contracts/foundry.toml +0 -0
  153. /package/{templates/phaser/packages/contracts/.gitignore_ → dist/templates/phaser/packages/contracts/gitignore} +0 -0
  154. /package/{templates → dist/templates}/phaser/packages/contracts/mud.config.ts +0 -0
  155. /package/{templates → dist/templates}/phaser/packages/contracts/package.json +0 -0
  156. /package/{templates → dist/templates}/phaser/packages/contracts/remappings.txt +0 -0
  157. /package/{templates → dist/templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
  158. /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
  159. /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
  160. /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
  161. /package/{templates → dist/templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  162. /package/{templates → dist/templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
  163. /package/{templates → dist/templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
  164. /package/{templates → dist/templates}/phaser/packages/contracts/tsconfig.json +0 -0
  165. /package/{templates → dist/templates}/phaser/packages/contracts/worlds.json +0 -0
  166. /package/{templates → dist/templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
  167. /package/{templates → dist/templates}/phaser/pnpm-workspace.yaml +0 -0
  168. /package/{templates → dist/templates}/phaser/tsconfig.json +0 -0
  169. /package/{templates → dist/templates}/react/.eslintrc +0 -0
  170. /package/{templates → dist/templates}/react/.gitattributes +0 -0
  171. /package/{templates → dist/templates}/react/.vscode/extensions.json +0 -0
  172. /package/{templates → dist/templates}/react/.vscode/settings.json +0 -0
  173. /package/{templates/react-ecs/.gitignore_ → dist/templates/react/gitignore} +0 -0
  174. /package/{templates/react-ecs → dist/templates/react}/mprocs.yaml +0 -0
  175. /package/{templates/react-ecs → dist/templates/react}/package.json +0 -0
  176. /package/{templates → dist/templates}/react/packages/client/.env +0 -0
  177. /package/{templates → dist/templates}/react/packages/client/.eslintrc +0 -0
  178. /package/{templates/react-ecs/packages/client/.gitignore_ → dist/templates/react/packages/client/gitignore} +0 -0
  179. /package/{templates/react-ecs → dist/templates/react}/packages/client/index.html +0 -0
  180. /package/{templates → dist/templates}/react/packages/client/package.json +0 -0
  181. /package/{templates/react-ecs → dist/templates/react}/packages/client/postcss.config.cjs +0 -0
  182. /package/{templates → dist/templates}/react/packages/client/src/App.tsx +0 -0
  183. /package/{templates → dist/templates}/react/packages/client/src/Providers.tsx +0 -0
  184. /package/{templates → dist/templates}/react/packages/client/src/common.ts +0 -0
  185. /package/{templates → dist/templates}/react/packages/client/src/game/GameMap.tsx +0 -0
  186. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/game/useKeyboardMovement.ts +0 -0
  187. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/index.tsx +0 -0
  188. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/mud/Explorer.tsx +0 -0
  189. /package/{templates → dist/templates}/react/packages/client/src/mud/stash.ts +0 -0
  190. /package/{templates → dist/templates}/react/packages/client/src/mud/useSyncStatus.ts +0 -0
  191. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/mud/useWorldContract.ts +0 -0
  192. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/AsyncButton.tsx +0 -0
  193. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/ErrorFallback.tsx +0 -0
  194. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -0
  195. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/ui/icons/MUDIcon.tsx +0 -0
  196. /package/{templates/react-ecs → dist/templates/react}/packages/client/src/wagmiConfig.ts +0 -0
  197. /package/{templates/react-ecs → dist/templates/react}/packages/client/tailwind.config.ts +0 -0
  198. /package/{templates/react-ecs → dist/templates/react}/packages/client/tsconfig.json +0 -0
  199. /package/{templates/react-ecs → dist/templates/react}/packages/client/vite.config.ts +0 -0
  200. /package/{templates/vanilla → dist/templates/react}/packages/contracts/.env +0 -0
  201. /package/{templates → dist/templates}/react/packages/contracts/.prettierrc +0 -0
  202. /package/{templates → dist/templates}/react/packages/contracts/.solhint.json +0 -0
  203. /package/{templates → dist/templates}/react/packages/contracts/foundry.toml +0 -0
  204. /package/{templates/react-ecs/packages/contracts/.gitignore_ → dist/templates/react/packages/contracts/gitignore} +0 -0
  205. /package/{templates → dist/templates}/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -0
  206. /package/{templates/react-ecs → dist/templates/react}/packages/contracts/package.json +0 -0
  207. /package/{templates → dist/templates}/react/packages/contracts/remappings.txt +0 -0
  208. /package/{templates/react-ecs → dist/templates/react}/packages/contracts/script/PostDeploy.s.sol +0 -0
  209. /package/{templates → dist/templates}/react/packages/contracts/src/MoveSystem.sol +0 -0
  210. /package/{templates/react-ecs → dist/templates/react}/packages/contracts/src/codegen/common.sol +0 -0
  211. /package/{templates → dist/templates}/react/packages/contracts/src/codegen/index.sol +0 -0
  212. /package/{templates → dist/templates}/react/packages/contracts/src/codegen/tables/Position.sol +0 -0
  213. /package/{templates → dist/templates}/react/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
  214. /package/{templates → dist/templates}/react/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  215. /package/{templates → dist/templates}/react/packages/contracts/tsconfig.json +0 -0
  216. /package/{templates/react-ecs → dist/templates/react}/packages/contracts/worlds.json +0 -0
  217. /package/{templates → dist/templates}/react/packages/contracts/worlds.json.d.ts +0 -0
  218. /package/{templates → dist/templates}/react/pnpm-workspace.yaml +0 -0
  219. /package/{templates → dist/templates}/react/tsconfig.json +0 -0
  220. /package/{templates → dist/templates}/react-ecs/.eslintrc +0 -0
  221. /package/{templates → dist/templates}/react-ecs/.gitattributes +0 -0
  222. /package/{templates → dist/templates}/react-ecs/.vscode/extensions.json +0 -0
  223. /package/{templates → dist/templates}/react-ecs/.vscode/settings.json +0 -0
  224. /package/{templates/threejs/.gitignore_ → dist/templates/react-ecs/gitignore} +0 -0
  225. /package/{templates/threejs → dist/templates/react-ecs}/mprocs.yaml +0 -0
  226. /package/{templates → dist/templates}/react-ecs/packages/client/.env +0 -0
  227. /package/{templates → dist/templates}/react-ecs/packages/client/.eslintrc +0 -0
  228. /package/{templates/threejs/packages/client/.gitignore_ → dist/templates/react-ecs/packages/client/gitignore} +0 -0
  229. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/index.html +0 -0
  230. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/MUDContext.tsx +0 -0
  231. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/index.tsx +0 -0
  232. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/createClientComponents.ts +0 -0
  233. /package/{templates/vanilla → dist/templates/react-ecs}/packages/client/src/mud/setup.ts +0 -0
  234. /package/{templates/vanilla → dist/templates/react-ecs}/packages/client/src/mud/setupNetwork.ts +0 -0
  235. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/supportedChains.ts +0 -0
  236. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/src/mud/world.ts +0 -0
  237. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/tsconfig.json +0 -0
  238. /package/{templates/threejs → dist/templates/react-ecs}/packages/client/vite.config.ts +0 -0
  239. /package/{templates/threejs → dist/templates/react-ecs}/packages/contracts/.env +0 -0
  240. /package/{templates → dist/templates}/react-ecs/packages/contracts/.prettierrc +0 -0
  241. /package/{templates → dist/templates}/react-ecs/packages/contracts/.solhint.json +0 -0
  242. /package/{templates → dist/templates}/react-ecs/packages/contracts/foundry.toml +0 -0
  243. /package/{templates/threejs/packages/contracts/.gitignore_ → dist/templates/react-ecs/packages/contracts/gitignore} +0 -0
  244. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/mud.config.ts +0 -0
  245. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/package.json +0 -0
  246. /package/{templates → dist/templates}/react-ecs/packages/contracts/remappings.txt +0 -0
  247. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +0 -0
  248. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/index.sol +0 -0
  249. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
  250. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
  251. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  252. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
  253. /package/{templates/vanilla → dist/templates/react-ecs}/packages/contracts/test/CounterTest.t.sol +0 -0
  254. /package/{templates → dist/templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
  255. /package/{templates/threejs → dist/templates/react-ecs}/packages/contracts/worlds.json +0 -0
  256. /package/{templates → dist/templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
  257. /package/{templates → dist/templates}/react-ecs/pnpm-workspace.yaml +0 -0
  258. /package/{templates → dist/templates}/react-ecs/tsconfig.json +0 -0
  259. /package/{templates → dist/templates}/threejs/.eslintrc +0 -0
  260. /package/{templates → dist/templates}/threejs/.gitattributes +0 -0
  261. /package/{templates → dist/templates}/threejs/.vscode/extensions.json +0 -0
  262. /package/{templates → dist/templates}/threejs/.vscode/settings.json +0 -0
  263. /package/{templates/vanilla/.gitignore_ → dist/templates/threejs/gitignore} +0 -0
  264. /package/{templates/vanilla → dist/templates/threejs}/mprocs.yaml +0 -0
  265. /package/{templates → dist/templates}/threejs/package.json +0 -0
  266. /package/{templates → dist/templates}/threejs/packages/client/.env +0 -0
  267. /package/{templates → dist/templates}/threejs/packages/client/.eslintrc +0 -0
  268. /package/{templates/vanilla/packages/client/.gitignore_ → dist/templates/threejs/packages/client/gitignore} +0 -0
  269. /package/{templates → dist/templates}/threejs/packages/client/package.json +0 -0
  270. /package/{templates → dist/templates}/threejs/packages/client/src/App.tsx +0 -0
  271. /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
  272. /package/{templates → dist/templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
  273. /package/{templates → dist/templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
  274. /package/{templates → dist/templates}/threejs/packages/client/src/mud/setup.ts +0 -0
  275. /package/{templates → dist/templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
  276. /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
  277. /package/{templates/vanilla → dist/templates/threejs}/packages/client/src/mud/world.ts +0 -0
  278. /package/{templates → dist/templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
  279. /package/{templates/vanilla → dist/templates/threejs}/packages/client/tsconfig.json +0 -0
  280. /package/{templates → dist/templates}/threejs/packages/contracts/.prettierrc +0 -0
  281. /package/{templates → dist/templates}/threejs/packages/contracts/.solhint.json +0 -0
  282. /package/{templates → dist/templates}/threejs/packages/contracts/foundry.toml +0 -0
  283. /package/{templates/vanilla/packages/contracts/.gitignore_ → dist/templates/threejs/packages/contracts/gitignore} +0 -0
  284. /package/{templates → dist/templates}/threejs/packages/contracts/mud.config.ts +0 -0
  285. /package/{templates → dist/templates}/threejs/packages/contracts/package.json +0 -0
  286. /package/{templates → dist/templates}/threejs/packages/contracts/remappings.txt +0 -0
  287. /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/index.sol +0 -0
  288. /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
  289. /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
  290. /package/{templates → dist/templates}/threejs/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  291. /package/{templates → dist/templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
  292. /package/{templates → dist/templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
  293. /package/{templates → dist/templates}/threejs/packages/contracts/tsconfig.json +0 -0
  294. /package/{templates/vanilla → dist/templates/threejs}/packages/contracts/worlds.json +0 -0
  295. /package/{templates → dist/templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
  296. /package/{templates → dist/templates}/threejs/pnpm-workspace.yaml +0 -0
  297. /package/{templates → dist/templates}/threejs/tsconfig.json +0 -0
  298. /package/{templates → dist/templates}/vanilla/.eslintrc +0 -0
  299. /package/{templates → dist/templates}/vanilla/.gitattributes +0 -0
  300. /package/{templates → dist/templates}/vanilla/.vscode/extensions.json +0 -0
  301. /package/{templates → dist/templates}/vanilla/.vscode/settings.json +0 -0
  302. /package/{templates → dist/templates}/vanilla/package.json +0 -0
  303. /package/{templates → dist/templates}/vanilla/packages/client/.env +0 -0
  304. /package/{templates → dist/templates}/vanilla/packages/client/index.html +0 -0
  305. /package/{templates → dist/templates}/vanilla/packages/client/package.json +0 -0
  306. /package/{templates → dist/templates}/vanilla/packages/client/src/index.ts +0 -0
  307. /package/{templates → dist/templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
  308. /package/{templates → dist/templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
  309. /package/{templates → dist/templates}/vanilla/packages/client/vite.config.ts +0 -0
  310. /package/{templates → dist/templates}/vanilla/packages/contracts/.prettierrc +0 -0
  311. /package/{templates → dist/templates}/vanilla/packages/contracts/.solhint.json +0 -0
  312. /package/{templates → dist/templates}/vanilla/packages/contracts/foundry.toml +0 -0
  313. /package/{templates → dist/templates}/vanilla/packages/contracts/remappings.txt +0 -0
  314. /package/{templates → dist/templates}/vanilla/packages/contracts/tsconfig.json +0 -0
  315. /package/{templates → dist/templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
  316. /package/{templates → dist/templates}/vanilla/pnpm-workspace.yaml +0 -0
  317. /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,3 @@
1
+ import { createWorld } from "@latticexyz/recs";
2
+
3
+ export const world = createWorld();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "types": ["vite/client", "vite-plugin-mud/env"],
4
+ "types": ["vite/client"],
5
5
  "target": "ESNext",
6
6
  "lib": ["ESNext", "DOM"],
7
7
  "jsx": "react-jsx",
@@ -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
@@ -0,0 +1,9 @@
1
+ out/
2
+ cache/
3
+ node_modules/
4
+ bindings/
5
+ artifacts/
6
+ broadcast/
7
+
8
+ # Ignore MUD deploy artifacts
9
+ deploys/**/*.json
@@ -0,0 +1,13 @@
1
+ import { defineWorld } from "@latticexyz/world";
2
+
3
+ export default defineWorld({
4
+ namespace: "app",
5
+ tables: {
6
+ Counter: {
7
+ schema: {
8
+ value: "uint32",
9
+ },
10
+ key: [],
11
+ },
12
+ },
13
+ });
@@ -17,7 +17,6 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@latticexyz/cli": "{{mud-version}}",
20
- "@latticexyz/entrykit": "{{mud-version}}",
21
20
  "@latticexyz/schema-type": "{{mud-version}}",
22
21
  "@latticexyz/store": "{{mud-version}}",
23
22
  "@latticexyz/world": "{{mud-version}}",
@@ -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
- // TODO
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
  }
@@ -3,9 +3,4 @@ pragma solidity >=0.8.24;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
6
- enum Direction {
7
- North,
8
- East,
9
- South,
10
- West
11
- }
6
+ import { Counter } from "./tables/Counter.sol";
@@ -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 EntityCount {
20
- // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "EntityCount", typeId: RESOURCE_TABLE });`
21
- ResourceId constant _tableId = ResourceId.wrap(0x74626170700000000000000000000000456e74697479436f756e740000000000);
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(0x0020010020000000000000000000000000000000000000000000000000000000);
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 (uint256)
29
- Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000);
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] = "count";
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 count.
63
+ * @notice Get value.
64
64
  */
65
- function getCount() internal view returns (uint256 count) {
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 (uint256(bytes32(_blob)));
69
+ return (uint32(bytes4(_blob)));
70
70
  }
71
71
 
72
72
  /**
73
- * @notice Get count.
73
+ * @notice Get value.
74
74
  */
75
- function _getCount() internal view returns (uint256 count) {
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 (uint256(bytes32(_blob)));
79
+ return (uint32(bytes4(_blob)));
80
80
  }
81
81
 
82
82
  /**
83
- * @notice Get count.
83
+ * @notice Get value.
84
84
  */
85
- function get() internal view returns (uint256 count) {
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 (uint256(bytes32(_blob)));
89
+ return (uint32(bytes4(_blob)));
90
90
  }
91
91
 
92
92
  /**
93
- * @notice Get count.
93
+ * @notice Get value.
94
94
  */
95
- function _get() internal view returns (uint256 count) {
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 (uint256(bytes32(_blob)));
99
+ return (uint32(bytes4(_blob)));
100
100
  }
101
101
 
102
102
  /**
103
- * @notice Set count.
103
+ * @notice Set value.
104
104
  */
105
- function setCount(uint256 count) internal {
105
+ function setValue(uint32 value) internal {
106
106
  bytes32[] memory _keyTuple = new bytes32[](0);
107
107
 
108
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
108
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
109
109
  }
110
110
 
111
111
  /**
112
- * @notice Set count.
112
+ * @notice Set value.
113
113
  */
114
- function _setCount(uint256 count) internal {
114
+ function _setValue(uint32 value) internal {
115
115
  bytes32[] memory _keyTuple = new bytes32[](0);
116
116
 
117
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
117
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
118
118
  }
119
119
 
120
120
  /**
121
- * @notice Set count.
121
+ * @notice Set value.
122
122
  */
123
- function set(uint256 count) internal {
123
+ function set(uint32 value) internal {
124
124
  bytes32[] memory _keyTuple = new bytes32[](0);
125
125
 
126
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
126
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
127
127
  }
128
128
 
129
129
  /**
130
- * @notice Set count.
130
+ * @notice Set value.
131
131
  */
132
- function _set(uint256 count) internal {
132
+ function _set(uint32 value) internal {
133
133
  bytes32[] memory _keyTuple = new bytes32[](0);
134
134
 
135
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
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(uint256 count) internal pure returns (bytes memory) {
161
- return abi.encodePacked(count);
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(uint256 count) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
171
- bytes memory _staticData = encodeStatic(count);
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
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "31337": {
3
+ "address": "0x8d8b6b8414e1e3dcfd4168561b9be6bd3bf6ec4b"
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,22 +1,17 @@
1
1
  {
2
2
  "name": "create-mud",
3
- "version": "2.2.17-f52b1476f04ce0be68691e3b021a81e0fb9cce99",
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
- "type": "module",
8
- "bin": "bin/cli.js",
7
+ "bin": "dist/cli.js",
9
8
  "files": [
10
- "bin",
11
- "dist",
12
- "templates"
9
+ "dist"
13
10
  ],
14
11
  "dependencies": {
15
- "fast-glob": "^3.3.3",
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 && pnpm run copy-templates",
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 copy-templates && pnpm vitest --run && pnpm run test:vanilla && pnpm run test:react && pnpm run test:react-ecs && pnpm run test:phaser && pnpm run test:threejs",
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": "bin/cli.js --name test-project --template phaser && pnpm --dir test-project install && shx rm -rf test-project",
36
- "test:react": "bin/cli.js --name test-project --template react && pnpm --dir test-project install && shx rm -rf test-project",
37
- "test:react-ecs": "bin/cli.js --name test-project --template react-ecs && pnpm --dir test-project install && shx rm -rf test-project",
38
- "test:threejs": "bin/cli.js --name test-project --template threejs && pnpm --dir test-project install && shx rm -rf test-project",
39
- "test:vanilla": "bin/cli.js --name test-project --template vanilla && pnpm --dir test-project install && shx rm -rf test-project"
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,4 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // workaround for https://github.com/pnpm/pnpm/issues/1801
4
- import "../dist/cli.js";
@@ -1,16 +0,0 @@
1
- .DS_Store
2
- logs
3
- *.log
4
-
5
- node_modules
6
-
7
- .env.*
8
-
9
- # foundry
10
- cache
11
- broadcast
12
- out/*
13
- !out/IWorld.sol
14
- out/IWorld.sol/*
15
- !out/IWorld.sol/IWorld.abi.json
16
- !out/IWorld.sol/IWorld.abi.d.json.ts
@@ -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,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -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
- };