create-mud 2.2.15-6aff69a91c627ddcc0c1dbccf7b71580e8e0a8fa → 2.2.15-7482a5ae322f26278722081838b6103ce6d264e6

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 (46) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/templates/react/gitignore +14 -5
  4. package/dist/templates/react/mprocs.yaml +9 -1
  5. package/dist/templates/react/package.json +28 -4
  6. package/dist/templates/react/packages/client/gitignore +0 -2
  7. package/dist/templates/react/packages/client/package.json +21 -12
  8. package/dist/templates/react/packages/client/postcss.config.cjs +6 -0
  9. package/dist/templates/react/packages/client/src/App.tsx +38 -100
  10. package/dist/templates/react/packages/client/src/GameMap.tsx +78 -0
  11. package/dist/templates/react/packages/client/src/Providers.tsx +44 -0
  12. package/dist/templates/react/packages/client/src/common.ts +6 -0
  13. package/dist/templates/react/packages/client/src/index.tsx +17 -31
  14. package/dist/templates/react/packages/client/src/mud/Explorer.tsx +32 -0
  15. package/dist/templates/react/packages/client/src/mud/getWorldDeploy.ts +23 -0
  16. package/dist/templates/react/packages/client/src/mud/stash.ts +4 -0
  17. package/dist/templates/react/packages/client/src/mud/useSyncProgress.ts +21 -0
  18. package/dist/templates/react/packages/client/src/mud/useWorldContract.ts +45 -0
  19. package/dist/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
  20. package/dist/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
  21. package/dist/templates/react/packages/client/src/useKeyboardMovement.ts +26 -0
  22. package/dist/templates/react/packages/client/src/wagmiConfig.ts +49 -0
  23. package/dist/templates/react/packages/client/tailwind.config.ts +10 -0
  24. package/dist/templates/react/packages/client/vite.config.ts +0 -6
  25. package/dist/templates/react/packages/contracts/gitignore +12 -8
  26. package/dist/templates/react/packages/contracts/mud.config.ts +13 -8
  27. package/dist/templates/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +2021 -0
  28. package/dist/templates/react/packages/contracts/package.json +8 -7
  29. package/dist/templates/react/packages/contracts/script/PostDeploy.s.sol +1 -9
  30. package/dist/templates/react/packages/contracts/src/MoveSystem.sol +26 -0
  31. package/dist/templates/react/packages/contracts/src/codegen/common.sol +11 -0
  32. package/dist/templates/react/packages/contracts/src/codegen/index.sol +1 -1
  33. package/dist/templates/react/packages/contracts/src/codegen/tables/Position.sol +318 -0
  34. package/dist/templates/react/packages/contracts/src/codegen/world/{ITasksSystem.sol → IMoveSystem.sol} +5 -9
  35. package/dist/templates/react/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  36. package/dist/templates/react/packages/contracts/worlds.json +1 -1
  37. package/package.json +1 -1
  38. package/dist/templates/react/packages/client/src/MUDContext.tsx +0 -21
  39. package/dist/templates/react/packages/client/src/mud/createSystemCalls.ts +0 -56
  40. package/dist/templates/react/packages/client/src/mud/getNetworkConfig.ts +0 -76
  41. package/dist/templates/react/packages/client/src/mud/setup.ts +0 -18
  42. package/dist/templates/react/packages/client/src/mud/setupNetwork.ts +0 -101
  43. package/dist/templates/react/packages/client/src/mud/supportedChains.ts +0 -20
  44. package/dist/templates/react/packages/contracts/src/codegen/tables/Tasks.sol +0 -522
  45. package/dist/templates/react/packages/contracts/src/systems/TasksSystem.sol +0 -24
  46. package/dist/templates/react/packages/contracts/test/TasksTest.t.sol +0 -30
@@ -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,26 @@
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
+ };
@@ -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
+ 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
+ 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;
@@ -3,12 +3,6 @@ import react from "@vitejs/plugin-react";
3
3
 
4
4
  export default defineConfig({
5
5
  plugins: [react()],
6
- server: {
7
- port: 3000,
8
- fs: {
9
- strict: false,
10
- },
11
- },
12
6
  build: {
13
7
  target: "es2022",
14
8
  minify: true,
@@ -1,9 +1,13 @@
1
- out/
2
- cache/
3
- node_modules/
4
- bindings/
5
- artifacts/
6
- broadcast/
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
7
9
 
8
- # Ignore MUD deploy artifacts
9
- deploys/**/*.json
10
+ # mud
11
+ .mud
12
+ deploys
13
+ *.db*
@@ -2,15 +2,20 @@ import { defineWorld } from "@latticexyz/world";
2
2
 
3
3
  export default defineWorld({
4
4
  namespace: "app",
5
+ enums: {
6
+ Direction: ["North", "East", "South", "West"],
7
+ },
5
8
  tables: {
6
- Tasks: {
7
- schema: {
8
- id: "bytes32",
9
- createdAt: "uint256",
10
- completedAt: "uint256",
11
- description: "string",
12
- },
13
- key: ["id"],
9
+ Position: {
10
+ schema: { player: "address", x: "int32", y: "int32" },
11
+ key: ["player"],
14
12
  },
15
13
  },
14
+ modules: [
15
+ {
16
+ artifactPath:
17
+ "@latticexyz/world-modules/out/Unstable_CallWithSignatureModule.sol/Unstable_CallWithSignatureModule.json",
18
+ root: true,
19
+ },
20
+ ],
16
21
  });