create-mud 2.2.16-59389b1e37bc84664972231989ce7fdc739cce42 → 2.2.17-03eae1330cef5cae129841958fb75541ef13fb43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/README.md +2 -4
  2. package/bin/cli.js +4 -0
  3. package/dist/cli.d.ts +2 -1
  4. package/dist/cli.js +9 -2
  5. package/dist/cli.js.map +1 -1
  6. package/package.json +17 -11
  7. package/templates/phaser/packages/contracts/worlds.json +5 -0
  8. package/templates/react/.gitignore_ +16 -0
  9. package/templates/react/mprocs.yaml +21 -0
  10. package/templates/react/package.json +31 -0
  11. package/templates/react/packages/client/.gitignore_ +1 -0
  12. package/{dist/templates/threejs → templates/react}/packages/client/index.html +2 -2
  13. package/{dist/templates → templates}/react/packages/client/package.json +17 -9
  14. package/templates/react/packages/client/postcss.config.cjs +6 -0
  15. package/templates/react/packages/client/src/App.tsx +46 -0
  16. package/templates/react/packages/client/src/Providers.tsx +35 -0
  17. package/templates/react/packages/client/src/common.ts +26 -0
  18. package/templates/react/packages/client/src/game/GameMap.tsx +102 -0
  19. package/templates/react/packages/client/src/game/useKeyboardMovement.ts +26 -0
  20. package/templates/react/packages/client/src/index.tsx +19 -0
  21. package/templates/react/packages/client/src/mud/Explorer.tsx +32 -0
  22. package/templates/react/packages/client/src/mud/Synced.tsx +14 -0
  23. package/templates/react/packages/client/src/mud/stash.ts +4 -0
  24. package/templates/react/packages/client/src/mud/useSyncStatus.ts +21 -0
  25. package/templates/react/packages/client/src/mud/useWorldContract.ts +44 -0
  26. package/templates/react/packages/client/src/ui/AsyncButton.tsx +41 -0
  27. package/templates/react/packages/client/src/ui/ErrorFallback.tsx +58 -0
  28. package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
  29. package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
  30. package/templates/react/packages/client/src/wagmiConfig.ts +49 -0
  31. package/templates/react/packages/client/tailwind.config.ts +10 -0
  32. package/templates/react/packages/client/tsconfig.json +11 -0
  33. package/{dist/templates/threejs → templates/react}/packages/client/vite.config.ts +2 -7
  34. package/templates/react/packages/contracts/.env +11 -0
  35. package/templates/react/packages/contracts/.gitignore_ +13 -0
  36. package/templates/react/packages/contracts/mud.config.ts +14 -0
  37. package/templates/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +2021 -0
  38. package/{dist/templates/vanilla → templates/react}/packages/contracts/package.json +1 -0
  39. package/{dist/templates → templates}/react/packages/contracts/script/PostDeploy.s.sol +1 -9
  40. package/templates/react/packages/contracts/src/MoveSystem.sol +26 -0
  41. package/{dist/templates/react/packages/contracts/src/codegen/index.sol → templates/react/packages/contracts/src/codegen/common.sol} +6 -1
  42. package/templates/react/packages/contracts/src/codegen/tables/Position.sol +318 -0
  43. package/{dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol → templates/react/packages/contracts/src/codegen/world/IMoveSystem.sol} +5 -3
  44. package/templates/react/packages/contracts/test/MoveTest.t.sol +25 -0
  45. package/templates/react/packages/contracts/test/WorldTest.t.sol +16 -0
  46. package/templates/react/packages/contracts/worlds.json +5 -0
  47. package/templates/react-ecs/.gitignore_ +16 -0
  48. package/templates/react-ecs/mprocs.yaml +21 -0
  49. package/templates/react-ecs/packages/client/.gitignore_ +1 -0
  50. package/{dist/templates/react → templates/react-ecs}/packages/client/index.html +2 -2
  51. package/{dist/templates → templates}/react-ecs/packages/client/package.json +16 -9
  52. package/templates/react-ecs/packages/client/postcss.config.cjs +6 -0
  53. package/templates/react-ecs/packages/client/src/App.tsx +74 -0
  54. package/templates/react-ecs/packages/client/src/Providers.tsx +29 -0
  55. package/templates/react-ecs/packages/client/src/common.ts +27 -0
  56. package/templates/react-ecs/packages/client/src/game/GameMap.tsx +112 -0
  57. package/templates/react-ecs/packages/client/src/game/useKeyboardMovement.ts +26 -0
  58. package/templates/react-ecs/packages/client/src/index.tsx +19 -0
  59. package/templates/react-ecs/packages/client/src/mud/Explorer.tsx +32 -0
  60. package/templates/react-ecs/packages/client/src/mud/Synced.tsx +14 -0
  61. package/templates/react-ecs/packages/client/src/mud/recs.ts +6 -0
  62. package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +17 -0
  63. package/templates/react-ecs/packages/client/src/mud/useWorldContract.ts +44 -0
  64. package/templates/react-ecs/packages/client/src/ui/AsyncButton.tsx +41 -0
  65. package/templates/react-ecs/packages/client/src/ui/ErrorFallback.tsx +58 -0
  66. package/templates/react-ecs/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
  67. package/templates/react-ecs/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
  68. package/templates/react-ecs/packages/client/src/wagmiConfig.ts +49 -0
  69. package/templates/react-ecs/packages/client/tailwind.config.ts +10 -0
  70. package/{dist/templates/threejs → templates/react-ecs}/packages/client/tsconfig.json +1 -1
  71. package/{dist/templates/react → templates/react-ecs}/packages/client/vite.config.ts +2 -7
  72. package/{dist/templates/threejs → templates/react-ecs}/packages/contracts/.env +1 -1
  73. package/templates/react-ecs/packages/contracts/.gitignore_ +13 -0
  74. package/templates/react-ecs/packages/contracts/mud.config.ts +18 -0
  75. package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +2039 -0
  76. package/{dist/templates/react → templates/react-ecs}/packages/contracts/package.json +1 -0
  77. package/{dist/templates/vanilla → templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +1 -5
  78. package/templates/react-ecs/packages/contracts/src/Entity.sol +20 -0
  79. package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +30 -0
  80. package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +18 -0
  81. package/{dist/templates/vanilla/packages/contracts/src/codegen/index.sol → templates/react-ecs/packages/contracts/src/codegen/common.sol} +6 -1
  82. package/templates/react-ecs/packages/contracts/src/codegen/index.sol +8 -0
  83. package/{dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol → templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol} +35 -35
  84. package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +202 -0
  85. package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +321 -0
  86. package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +16 -0
  87. package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +15 -0
  88. package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +17 -0
  89. package/templates/react-ecs/packages/contracts/src/createEntity.sol +11 -0
  90. package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +39 -0
  91. package/templates/react-ecs/packages/contracts/test/WorldTest.t.sol +16 -0
  92. package/templates/react-ecs/packages/contracts/worlds.json +5 -0
  93. package/templates/threejs/packages/contracts/src/codegen/index.sol +6 -0
  94. package/{dist/templates/react → templates/threejs}/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  95. package/templates/threejs/packages/contracts/worlds.json +5 -0
  96. package/templates/vanilla/packages/contracts/worlds.json +5 -0
  97. package/dist/templates/phaser/packages/contracts/worlds.json +0 -5
  98. package/dist/templates/react/packages/client/src/App.tsx +0 -105
  99. package/dist/templates/react/packages/client/src/MUDContext.tsx +0 -21
  100. package/dist/templates/react/packages/client/src/index.tsx +0 -34
  101. package/dist/templates/react/packages/client/src/mud/createSystemCalls.ts +0 -56
  102. package/dist/templates/react/packages/client/src/mud/getNetworkConfig.ts +0 -76
  103. package/dist/templates/react/packages/client/src/mud/setup.ts +0 -18
  104. package/dist/templates/react/packages/client/src/mud/setupNetwork.ts +0 -101
  105. package/dist/templates/react/packages/contracts/mud.config.ts +0 -16
  106. package/dist/templates/react/packages/contracts/src/codegen/tables/Tasks.sol +0 -522
  107. package/dist/templates/react/packages/contracts/src/codegen/world/ITasksSystem.sol +0 -19
  108. package/dist/templates/react/packages/contracts/src/systems/TasksSystem.sol +0 -24
  109. package/dist/templates/react/packages/contracts/test/TasksTest.t.sol +0 -30
  110. package/dist/templates/react/packages/contracts/worlds.json +0 -5
  111. package/dist/templates/react-ecs/package.json +0 -32
  112. package/dist/templates/react-ecs/packages/client/src/App.tsx +0 -29
  113. package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +0 -51
  114. package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +0 -77
  115. package/dist/templates/react-ecs/packages/contracts/worlds.json +0 -5
  116. package/dist/templates/threejs/gitignore +0 -7
  117. package/dist/templates/threejs/mprocs.yaml +0 -13
  118. package/dist/templates/threejs/packages/client/gitignore +0 -3
  119. package/dist/templates/threejs/packages/client/src/MUDContext.tsx +0 -21
  120. package/dist/templates/threejs/packages/client/src/index.tsx +0 -34
  121. package/dist/templates/threejs/packages/client/src/mud/supportedChains.ts +0 -20
  122. package/dist/templates/threejs/packages/contracts/gitignore +0 -9
  123. package/dist/templates/threejs/packages/contracts/worlds.json +0 -5
  124. package/dist/templates/vanilla/gitignore +0 -7
  125. package/dist/templates/vanilla/mprocs.yaml +0 -13
  126. package/dist/templates/vanilla/packages/client/gitignore +0 -3
  127. package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +0 -21
  128. package/dist/templates/vanilla/packages/client/src/mud/setup.ts +0 -21
  129. package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +0 -106
  130. package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +0 -20
  131. package/dist/templates/vanilla/packages/client/src/mud/world.ts +0 -3
  132. package/dist/templates/vanilla/packages/client/tsconfig.json +0 -11
  133. package/dist/templates/vanilla/packages/contracts/.env +0 -11
  134. package/dist/templates/vanilla/packages/contracts/gitignore +0 -9
  135. package/dist/templates/vanilla/packages/contracts/mud.config.ts +0 -13
  136. package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +0 -16
  137. package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +0 -14
  138. package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +0 -31
  139. package/dist/templates/vanilla/packages/contracts/worlds.json +0 -5
  140. /package/{dist/templates → templates}/phaser/.eslintrc +0 -0
  141. /package/{dist/templates → templates}/phaser/.gitattributes +0 -0
  142. /package/{dist/templates/phaser/gitignore → templates/phaser/.gitignore_} +0 -0
  143. /package/{dist/templates → templates}/phaser/.vscode/extensions.json +0 -0
  144. /package/{dist/templates → templates}/phaser/.vscode/settings.json +0 -0
  145. /package/{dist/templates → templates}/phaser/mprocs.yaml +0 -0
  146. /package/{dist/templates → templates}/phaser/package.json +0 -0
  147. /package/{dist/templates/phaser/packages/art/gitignore → templates/phaser/packages/art/.gitignore_} +0 -0
  148. /package/{dist/templates → templates}/phaser/packages/art/README.md +0 -0
  149. /package/{dist/templates → templates}/phaser/packages/art/config-sprites.json +0 -0
  150. /package/{dist/templates → templates}/phaser/packages/art/package.json +0 -0
  151. /package/{dist/templates → templates}/phaser/packages/art/scripts/cli.mjs +0 -0
  152. /package/{dist/templates → templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
  153. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
  154. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
  155. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
  156. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
  157. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
  158. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
  159. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
  160. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
  161. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
  162. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
  163. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
  164. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
  165. /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
  166. /package/{dist/templates → templates}/phaser/packages/art/tilesets/images/world.png +0 -0
  167. /package/{dist/templates → templates}/phaser/packages/art/tilesets/world.tsx +0 -0
  168. /package/{dist/templates → templates}/phaser/packages/client/.env +0 -0
  169. /package/{dist/templates → templates}/phaser/packages/client/.eslintrc +0 -0
  170. /package/{dist/templates/phaser/packages/client/gitignore → templates/phaser/packages/client/.gitignore_} +0 -0
  171. /package/{dist/templates → templates}/phaser/packages/client/index.html +0 -0
  172. /package/{dist/templates → templates}/phaser/packages/client/package.json +0 -0
  173. /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
  174. /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
  175. /package/{dist/templates → templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
  176. /package/{dist/templates → templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
  177. /package/{dist/templates → templates}/phaser/packages/client/src/index.tsx +0 -0
  178. /package/{dist/templates → templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
  179. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
  180. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
  181. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
  182. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
  183. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
  184. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
  185. /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
  186. /package/{dist/templates → templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
  187. /package/{dist/templates → templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
  188. /package/{dist/templates → templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
  189. /package/{dist/templates → templates}/phaser/packages/client/src/mud/setup.ts +0 -0
  190. /package/{dist/templates → templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
  191. /package/{dist/templates → templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
  192. /package/{dist/templates → templates}/phaser/packages/client/src/mud/world.ts +0 -0
  193. /package/{dist/templates → templates}/phaser/packages/client/src/store.ts +0 -0
  194. /package/{dist/templates → templates}/phaser/packages/client/src/ui/App.tsx +0 -0
  195. /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
  196. /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
  197. /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
  198. /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
  199. /package/{dist/templates → templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
  200. /package/{dist/templates → templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
  201. /package/{dist/templates → templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
  202. /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
  203. /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
  204. /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
  205. /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
  206. /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
  207. /package/{dist/templates → templates}/phaser/packages/client/tsconfig.json +0 -0
  208. /package/{dist/templates → templates}/phaser/packages/client/vite.config.ts +0 -0
  209. /package/{dist/templates → templates}/phaser/packages/contracts/.env +0 -0
  210. /package/{dist/templates/phaser/packages/contracts/gitignore → templates/phaser/packages/contracts/.gitignore_} +0 -0
  211. /package/{dist/templates → templates}/phaser/packages/contracts/.prettierrc +0 -0
  212. /package/{dist/templates → templates}/phaser/packages/contracts/.solhint.json +0 -0
  213. /package/{dist/templates → templates}/phaser/packages/contracts/foundry.toml +0 -0
  214. /package/{dist/templates → templates}/phaser/packages/contracts/mud.config.ts +0 -0
  215. /package/{dist/templates → templates}/phaser/packages/contracts/package.json +0 -0
  216. /package/{dist/templates → templates}/phaser/packages/contracts/remappings.txt +0 -0
  217. /package/{dist/templates → templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
  218. /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
  219. /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
  220. /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
  221. /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  222. /package/{dist/templates → templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
  223. /package/{dist/templates → templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
  224. /package/{dist/templates → templates}/phaser/packages/contracts/tsconfig.json +0 -0
  225. /package/{dist/templates → templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
  226. /package/{dist/templates → templates}/phaser/pnpm-workspace.yaml +0 -0
  227. /package/{dist/templates → templates}/phaser/tsconfig.json +0 -0
  228. /package/{dist/templates → templates}/react/.eslintrc +0 -0
  229. /package/{dist/templates → templates}/react/.gitattributes +0 -0
  230. /package/{dist/templates → templates}/react/.vscode/extensions.json +0 -0
  231. /package/{dist/templates → templates}/react/.vscode/settings.json +0 -0
  232. /package/{dist/templates → templates}/react/packages/client/.env +0 -0
  233. /package/{dist/templates → templates}/react/packages/client/.eslintrc +0 -0
  234. /package/{dist/templates → templates}/react/packages/contracts/.prettierrc +0 -0
  235. /package/{dist/templates → templates}/react/packages/contracts/.solhint.json +0 -0
  236. /package/{dist/templates → templates}/react/packages/contracts/foundry.toml +0 -0
  237. /package/{dist/templates → templates}/react/packages/contracts/remappings.txt +0 -0
  238. /package/{dist/templates/threejs → templates/react}/packages/contracts/src/codegen/index.sol +0 -0
  239. /package/{dist/templates/threejs → templates/react}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  240. /package/{dist/templates → templates}/react/packages/contracts/tsconfig.json +0 -0
  241. /package/{dist/templates → templates}/react/packages/contracts/worlds.json.d.ts +0 -0
  242. /package/{dist/templates → templates}/react/pnpm-workspace.yaml +0 -0
  243. /package/{dist/templates → templates}/react/tsconfig.json +0 -0
  244. /package/{dist/templates → templates}/react-ecs/.eslintrc +0 -0
  245. /package/{dist/templates → templates}/react-ecs/.gitattributes +0 -0
  246. /package/{dist/templates → templates}/react-ecs/.vscode/extensions.json +0 -0
  247. /package/{dist/templates → templates}/react-ecs/.vscode/settings.json +0 -0
  248. /package/{dist/templates/react → templates/react-ecs}/package.json +0 -0
  249. /package/{dist/templates → templates}/react-ecs/packages/client/.env +0 -0
  250. /package/{dist/templates → templates}/react-ecs/packages/client/.eslintrc +0 -0
  251. /package/{dist/templates → templates}/react-ecs/packages/contracts/.prettierrc +0 -0
  252. /package/{dist/templates → templates}/react-ecs/packages/contracts/.solhint.json +0 -0
  253. /package/{dist/templates → templates}/react-ecs/packages/contracts/foundry.toml +0 -0
  254. /package/{dist/templates → templates}/react-ecs/packages/contracts/remappings.txt +0 -0
  255. /package/{dist/templates → templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
  256. /package/{dist/templates → templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
  257. /package/{dist/templates → templates}/react-ecs/pnpm-workspace.yaml +0 -0
  258. /package/{dist/templates → templates}/react-ecs/tsconfig.json +0 -0
  259. /package/{dist/templates → templates}/threejs/.eslintrc +0 -0
  260. /package/{dist/templates → templates}/threejs/.gitattributes +0 -0
  261. /package/{dist/templates/react-ecs/gitignore → templates/threejs/.gitignore_} +0 -0
  262. /package/{dist/templates → templates}/threejs/.vscode/extensions.json +0 -0
  263. /package/{dist/templates → templates}/threejs/.vscode/settings.json +0 -0
  264. /package/{dist/templates/react-ecs → templates/threejs}/mprocs.yaml +0 -0
  265. /package/{dist/templates → templates}/threejs/package.json +0 -0
  266. /package/{dist/templates → templates}/threejs/packages/client/.env +0 -0
  267. /package/{dist/templates → templates}/threejs/packages/client/.eslintrc +0 -0
  268. /package/{dist/templates/react-ecs/packages/client/gitignore → templates/threejs/packages/client/.gitignore_} +0 -0
  269. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/index.html +0 -0
  270. /package/{dist/templates → templates}/threejs/packages/client/package.json +0 -0
  271. /package/{dist/templates → templates}/threejs/packages/client/src/App.tsx +0 -0
  272. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/MUDContext.tsx +0 -0
  273. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/index.tsx +0 -0
  274. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
  275. /package/{dist/templates → templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
  276. /package/{dist/templates → templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
  277. /package/{dist/templates → templates}/threejs/packages/client/src/mud/setup.ts +0 -0
  278. /package/{dist/templates → templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
  279. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
  280. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/world.ts +0 -0
  281. /package/{dist/templates → templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
  282. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/tsconfig.json +0 -0
  283. /package/{dist/templates/react-ecs → templates/threejs}/packages/client/vite.config.ts +0 -0
  284. /package/{dist/templates/react-ecs → templates/threejs}/packages/contracts/.env +0 -0
  285. /package/{dist/templates/react-ecs/packages/contracts/gitignore → templates/threejs/packages/contracts/.gitignore_} +0 -0
  286. /package/{dist/templates → templates}/threejs/packages/contracts/.prettierrc +0 -0
  287. /package/{dist/templates → templates}/threejs/packages/contracts/.solhint.json +0 -0
  288. /package/{dist/templates → templates}/threejs/packages/contracts/foundry.toml +0 -0
  289. /package/{dist/templates → templates}/threejs/packages/contracts/mud.config.ts +0 -0
  290. /package/{dist/templates → templates}/threejs/packages/contracts/package.json +0 -0
  291. /package/{dist/templates → templates}/threejs/packages/contracts/remappings.txt +0 -0
  292. /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
  293. /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
  294. /package/{dist/templates → templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
  295. /package/{dist/templates → templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
  296. /package/{dist/templates → templates}/threejs/packages/contracts/tsconfig.json +0 -0
  297. /package/{dist/templates → templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
  298. /package/{dist/templates → templates}/threejs/pnpm-workspace.yaml +0 -0
  299. /package/{dist/templates → templates}/threejs/tsconfig.json +0 -0
  300. /package/{dist/templates → templates}/vanilla/.eslintrc +0 -0
  301. /package/{dist/templates → templates}/vanilla/.gitattributes +0 -0
  302. /package/{dist/templates/react/gitignore → templates/vanilla/.gitignore_} +0 -0
  303. /package/{dist/templates → templates}/vanilla/.vscode/extensions.json +0 -0
  304. /package/{dist/templates → templates}/vanilla/.vscode/settings.json +0 -0
  305. /package/{dist/templates/react → templates/vanilla}/mprocs.yaml +0 -0
  306. /package/{dist/templates → templates}/vanilla/package.json +0 -0
  307. /package/{dist/templates → templates}/vanilla/packages/client/.env +0 -0
  308. /package/{dist/templates/react/packages/client/gitignore → templates/vanilla/packages/client/.gitignore_} +0 -0
  309. /package/{dist/templates → templates}/vanilla/packages/client/index.html +0 -0
  310. /package/{dist/templates → templates}/vanilla/packages/client/package.json +0 -0
  311. /package/{dist/templates → templates}/vanilla/packages/client/src/index.ts +0 -0
  312. /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/createClientComponents.ts +0 -0
  313. /package/{dist/templates → templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
  314. /package/{dist/templates → templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
  315. /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setup.ts +0 -0
  316. /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setupNetwork.ts +0 -0
  317. /package/{dist/templates/react → templates/vanilla}/packages/client/src/mud/supportedChains.ts +0 -0
  318. /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/world.ts +0 -0
  319. /package/{dist/templates/react → templates/vanilla}/packages/client/tsconfig.json +0 -0
  320. /package/{dist/templates → templates}/vanilla/packages/client/vite.config.ts +0 -0
  321. /package/{dist/templates/react → templates/vanilla}/packages/contracts/.env +0 -0
  322. /package/{dist/templates/react/packages/contracts/gitignore → templates/vanilla/packages/contracts/.gitignore_} +0 -0
  323. /package/{dist/templates → templates}/vanilla/packages/contracts/.prettierrc +0 -0
  324. /package/{dist/templates → templates}/vanilla/packages/contracts/.solhint.json +0 -0
  325. /package/{dist/templates → templates}/vanilla/packages/contracts/foundry.toml +0 -0
  326. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/mud.config.ts +0 -0
  327. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/package.json +0 -0
  328. /package/{dist/templates → templates}/vanilla/packages/contracts/remappings.txt +0 -0
  329. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +0 -0
  330. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/index.sol +0 -0
  331. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
  332. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
  333. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
  334. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
  335. /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/test/CounterTest.t.sol +0 -0
  336. /package/{dist/templates → templates}/vanilla/packages/contracts/tsconfig.json +0 -0
  337. /package/{dist/templates → templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
  338. /package/{dist/templates → templates}/vanilla/pnpm-workspace.yaml +0 -0
  339. /package/{dist/templates → templates}/vanilla/tsconfig.json +0 -0
@@ -0,0 +1,44 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ };
@@ -0,0 +1,58 @@
1
+ import { wait } from "@latticexyz/common/utils";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { FallbackProps } from "react-error-boundary";
4
+
5
+ export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
6
+ const when = new Date();
7
+ const isMounted = useRef(false);
8
+ const [retries, setRetries] = useState(1);
9
+
10
+ useEffect(() => {
11
+ isMounted.current = true;
12
+ return () => {
13
+ isMounted.current = false;
14
+ };
15
+ });
16
+
17
+ return (
18
+ <div className="fixed inset-0 overflow-auto bg-red-50">
19
+ <div className="w-full max-w-screen-md mx-auto py-16 px-8 space-y-12">
20
+ <h1 className="text-4xl font-black text-red-500">Oops! It broke :(</h1>
21
+ <div className="space-y-6">
22
+ <div className="relative">
23
+ <div className="p-6 bg-red-100 border-l-8 -ml-[8px] border-red-500 font-semibold whitespace-pre-wrap">
24
+ {error instanceof Error ? error.message : String(error)}
25
+ </div>
26
+ {error instanceof Error && error.stack ? (
27
+ <div className="p-6 bg-white font-mono text-sm overflow-auto whitespace-pre">{error.stack}</div>
28
+ ) : null}
29
+ <div className="absolute top-full right-0 text-sm text-stone-400" title={when.toISOString()}>
30
+ {when.toLocaleString()}
31
+ </div>
32
+ </div>
33
+
34
+ {retries > 0 ? (
35
+ <button
36
+ type="button"
37
+ className="group bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 active:bg-red-700 transition aria-busy:pointer-events-none aria-busy:animate-pulse"
38
+ onClick={async (event) => {
39
+ // if we retry and the same error occurs, it'll look like the button click did nothing
40
+ // so we'll fake a pending state here to give users an indication something is happening
41
+ event.currentTarget.ariaBusy = "true";
42
+ await wait(1000);
43
+ resetErrorBoundary();
44
+ if (isMounted.current) {
45
+ setRetries((value) => value - 1);
46
+ event.currentTarget.ariaBusy = null;
47
+ }
48
+ }}
49
+ >
50
+ <span className="group-aria-busy:hidden">Retry?</span>
51
+ <span className="hidden group-aria-busy:inline">Retrying…</span>
52
+ </button>
53
+ ) : null}
54
+ </div>
55
+ </div>
56
+ </div>
57
+ );
58
+ }
@@ -0,0 +1,22 @@
1
+ import { DetailedHTMLProps, SVGAttributes } from "react";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export type Props = DetailedHTMLProps<SVGAttributes<SVGSVGElement>, SVGSVGElement>;
5
+
6
+ export function ArrowDownIcon({ className, ...props }: Props) {
7
+ return (
8
+ <svg
9
+ className={twMerge("h-[1em] w-[1em]", className)}
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ viewBox="0 0 16 16"
12
+ fill="currentColor"
13
+ {...props}
14
+ >
15
+ <path
16
+ fillRule="evenodd"
17
+ d="M8 2a.75.75 0 0 1 .75.75v8.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.22 3.22V2.75A.75.75 0 0 1 8 2Z"
18
+ clipRule="evenodd"
19
+ />
20
+ </svg>
21
+ );
22
+ }
@@ -0,0 +1,25 @@
1
+ import { DetailedHTMLProps, SVGAttributes } from "react";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export type Props = DetailedHTMLProps<SVGAttributes<SVGSVGElement>, SVGSVGElement>;
5
+
6
+ export function MUDIcon({ className, ...props }: Props) {
7
+ return (
8
+ <svg
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ viewBox="0 0 8 8"
11
+ fill="currentColor"
12
+ shapeRendering="crispEdges"
13
+ className={twMerge("-my-[0.125em] h-[1.25em] w-[1.25em]", className)}
14
+ {...props}
15
+ >
16
+ {/* eslint-disable-next-line max-len */}
17
+ <path d="M0 0h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm0 1h1v1H0zm1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm2-1h1v1H7zm0 1h1v1H7zM6 7h1v1H6zm1-2h1v1H7zm0-1h1v1H7zm0-1h1v1H7z" />
18
+ <path
19
+ d="M2 2h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm0 1h1v1H2zm1-3h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm0 1h1v1H5zm0 1h1v1H5zm0 1h1v1H5zM4 5h1v1H4zM3 5h1v1H3z"
20
+ opacity=".5"
21
+ />
22
+ <path d="M7 2h1v1H7zm0-1h1v1H7zM1 0h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z" />
23
+ </svg>
24
+ );
25
+ }
@@ -0,0 +1,49 @@
1
+ import { Chain, http, webSocket } from "viem";
2
+ import { anvil } from "viem/chains";
3
+ import { createWagmiConfig } from "@latticexyz/entrykit/internal";
4
+ import { rhodolite, garnet, redstone } from "@latticexyz/common/chains";
5
+ import { chainId } from "./common";
6
+
7
+ export const chains = [
8
+ redstone,
9
+ garnet,
10
+ rhodolite,
11
+ {
12
+ ...anvil,
13
+ contracts: {
14
+ ...anvil.contracts,
15
+ paymaster: {
16
+ address: "0xf03E61E7421c43D9068Ca562882E98d1be0a6b6e",
17
+ },
18
+ },
19
+ blockExplorers: {
20
+ default: {} as never,
21
+ worldsExplorer: {
22
+ name: "MUD Worlds Explorer",
23
+ url: "http://localhost:13690/anvil/worlds",
24
+ },
25
+ },
26
+ },
27
+ ] as const satisfies Chain[];
28
+
29
+ export const transports = {
30
+ [anvil.id]: webSocket(),
31
+ [garnet.id]: http(),
32
+ [rhodolite.id]: http(),
33
+ [redstone.id]: http(),
34
+ } as const;
35
+
36
+ export const wagmiConfig = createWagmiConfig({
37
+ chainId,
38
+ // TODO: swap this with another default project ID or leave empty
39
+ walletConnectProjectId: "14ce88fdbc0f9c294e26ec9b4d848e44",
40
+ appName: document.title,
41
+ chains,
42
+ transports,
43
+ pollingInterval: {
44
+ [anvil.id]: 2000,
45
+ [garnet.id]: 2000,
46
+ [rhodolite.id]: 2000,
47
+ [redstone.id]: 2000,
48
+ },
49
+ });
@@ -0,0 +1,10 @@
1
+ import { Config } from "tailwindcss/types/config";
2
+
3
+ export default {
4
+ content: ["./**/*.{html,js,jsx,ts,tsx}", "!./node_modules"],
5
+ theme: {},
6
+ plugins: [],
7
+ future: {
8
+ hoverOnlyWhenSupported: true,
9
+ },
10
+ } satisfies Config;
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["vite/client", "vite-plugin-mud/env"],
5
+ "target": "ESNext",
6
+ "lib": ["ESNext", "DOM"],
7
+ "jsx": "react-jsx",
8
+ "jsxImportSource": "react"
9
+ },
10
+ "include": ["src"]
11
+ }
@@ -1,14 +1,9 @@
1
1
  import { defineConfig } from "vite";
2
2
  import react from "@vitejs/plugin-react";
3
+ import { mud } from "vite-plugin-mud";
3
4
 
4
5
  export default defineConfig({
5
- plugins: [react()],
6
- server: {
7
- port: 3000,
8
- fs: {
9
- strict: false,
10
- },
11
- },
6
+ plugins: [react(), mud({ worldsFile: "../contracts/worlds.json" })],
12
7
  build: {
13
8
  target: "es2022",
14
9
  minify: true,
@@ -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,13 @@
1
+ # foundry
2
+ cache
3
+ broadcast
4
+ out/*
5
+ !out/IWorld.sol
6
+ out/IWorld.sol/*
7
+ !out/IWorld.sol/IWorld.abi.json
8
+ !out/IWorld.sol/IWorld.abi.d.json.ts
9
+
10
+ # mud
11
+ .mud
12
+ deploys
13
+ *.db*
@@ -0,0 +1,14 @@
1
+ import { defineWorld } from "@latticexyz/world";
2
+
3
+ export default defineWorld({
4
+ namespace: "app",
5
+ enums: {
6
+ Direction: ["North", "East", "South", "West"],
7
+ },
8
+ tables: {
9
+ Position: {
10
+ schema: { player: "address", x: "int32", y: "int32" },
11
+ key: ["player"],
12
+ },
13
+ },
14
+ });