create-mud 2.0.0-alpha.1.21 → 2.0.0-alpha.1.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +1 -1
- package/dist/templates/{minimal/packages/client → phaser}/.eslintrc +1 -3
- package/dist/templates/phaser/package.json +28 -0
- package/dist/templates/phaser/packages/art/.gitignore +0 -0
- package/dist/templates/phaser/packages/art/README.md +33 -0
- package/dist/templates/phaser/packages/art/config-sprites.json +21 -0
- package/dist/templates/phaser/packages/art/package.json +27 -0
- package/dist/templates/phaser/packages/art/scripts/cli.mjs +190 -0
- package/dist/templates/phaser/packages/art/scripts/export-tiled-types.ts +292 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/0.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/1.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/2.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/3.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/4.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/attack/5.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/death/0.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/death/1.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/death/2.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/idle/0.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/idle/1.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/idle/2.png +0 -0
- package/dist/templates/phaser/packages/art/sprites/golem/idle/3.png +0 -0
- package/dist/templates/phaser/packages/art/tilesets/images/world.png +0 -0
- package/dist/templates/phaser/packages/art/tilesets/world.tsx +19 -0
- package/dist/templates/phaser/packages/client/.env +1 -0
- package/dist/templates/phaser/packages/client/.eslintrc +7 -0
- package/dist/templates/phaser/packages/client/index.html +39 -0
- package/dist/templates/phaser/packages/client/package.json +48 -0
- package/dist/templates/phaser/packages/client/public/assets/atlases/atlas.json +292 -0
- package/dist/templates/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
- package/dist/templates/phaser/packages/client/public/assets/tilesets/world.png +0 -0
- package/dist/templates/phaser/packages/client/src/artTypes/world.ts +9 -0
- package/dist/templates/phaser/packages/client/src/index.tsx +11 -0
- package/dist/templates/phaser/packages/client/src/layers/network/createNetworkLayer.ts +24 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/configurePhaser.ts +91 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/constants.ts +22 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +33 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +13 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +32 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/systems/index.ts +1 -0
- package/dist/templates/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +8 -0
- package/dist/templates/phaser/packages/client/src/mud/contractComponents.ts +24 -0
- package/dist/templates/phaser/packages/client/src/mud/createClientComponents.ts +10 -0
- package/dist/templates/phaser/packages/client/src/mud/createSystemCalls.ts +21 -0
- package/dist/templates/phaser/packages/client/src/mud/getNetworkConfig.ts +53 -0
- package/dist/templates/phaser/packages/client/src/mud/setup.ts +16 -0
- package/dist/templates/phaser/packages/client/src/mud/setupNetwork.ts +102 -0
- package/dist/templates/phaser/packages/client/src/mud/supportedChains.ts +5 -0
- package/dist/templates/phaser/packages/client/src/mud/world.ts +3 -0
- package/dist/templates/phaser/packages/client/src/store.ts +38 -0
- package/dist/templates/phaser/packages/client/src/ui/App.tsx +23 -0
- package/dist/templates/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +42 -0
- package/dist/templates/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +21 -0
- package/dist/templates/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +52 -0
- package/dist/templates/phaser/packages/client/src/ui/LoadingScreen/index.ts +1 -0
- package/dist/templates/phaser/packages/client/src/ui/PhaserLayer.tsx +20 -0
- package/dist/templates/phaser/packages/client/src/ui/UIRoot.tsx +20 -0
- package/dist/templates/phaser/packages/client/src/ui/Wrapper.tsx +5 -0
- package/dist/templates/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +17 -0
- package/dist/templates/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +87 -0
- package/dist/templates/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +24 -0
- package/dist/templates/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +18 -0
- package/dist/templates/phaser/packages/client/src/ui/theme/SpriteImage.tsx +52 -0
- package/dist/templates/{minimal → phaser}/packages/client/tsconfig.json +3 -4
- package/dist/templates/phaser/packages/client/vite.config.ts +15 -0
- package/dist/templates/phaser/packages/contracts/.env +8 -0
- package/dist/templates/{minimal → phaser}/packages/contracts/.gitignore +3 -2
- package/dist/templates/{minimal → phaser}/packages/contracts/.solhint.json +2 -1
- package/dist/templates/phaser/packages/contracts/foundry.toml +22 -0
- package/dist/templates/phaser/packages/contracts/mud.config.ts +10 -0
- package/dist/templates/phaser/packages/contracts/package.json +45 -0
- package/dist/templates/phaser/packages/contracts/remappings.txt +3 -0
- package/dist/templates/phaser/packages/contracts/script/PostDeploy.s.sol +17 -0
- package/dist/templates/phaser/packages/contracts/src/codegen/Tables.sol +6 -0
- package/dist/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol +120 -0
- package/dist/templates/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +8 -0
- package/dist/templates/phaser/packages/contracts/src/codegen/world/IWorld.sol +16 -0
- package/dist/templates/phaser/packages/contracts/src/systems/IncrementSystem.sol +14 -0
- package/dist/templates/phaser/packages/contracts/test/CounterTest.t.sol +38 -0
- package/dist/templates/phaser/packages/contracts/tsconfig.json +13 -0
- package/dist/templates/phaser/packages/contracts/worlds.json +5 -0
- package/dist/templates/react/.eslintrc +10 -0
- package/dist/templates/react/package.json +13 -3
- package/dist/templates/react/packages/client/.env +1 -0
- package/dist/templates/react/packages/client/.eslintrc +2 -12
- package/dist/templates/react/packages/client/package.json +18 -21
- package/dist/templates/react/packages/client/src/App.tsx +11 -13
- package/dist/templates/react/packages/client/src/MUDContext.tsx +21 -0
- package/dist/templates/react/packages/client/src/index.tsx +12 -31
- package/dist/templates/react/packages/client/src/mud/contractComponents.ts +24 -0
- package/dist/templates/react/packages/client/src/mud/createClientComponents.ts +10 -0
- package/dist/templates/react/packages/client/src/mud/createSystemCalls.ts +21 -0
- package/dist/templates/react/packages/client/src/mud/getNetworkConfig.ts +53 -0
- package/dist/templates/react/packages/client/src/mud/setup.ts +16 -0
- package/dist/templates/react/packages/client/src/mud/setupNetwork.ts +102 -0
- package/dist/templates/react/packages/client/src/mud/supportedChains.ts +5 -0
- package/dist/templates/react/packages/client/src/mud/world.ts +3 -0
- package/dist/templates/react/packages/client/tsconfig.json +0 -3
- package/dist/templates/react/packages/client/vite.config.ts +3 -0
- package/dist/templates/react/packages/contracts/.env +8 -0
- package/dist/templates/react/packages/contracts/.gitignore +3 -2
- package/dist/templates/react/packages/contracts/.solhint.json +2 -1
- package/dist/templates/react/packages/contracts/foundry.toml +13 -2
- package/dist/templates/react/packages/contracts/mud.config.ts +10 -0
- package/dist/templates/react/packages/contracts/package.json +25 -20
- package/dist/templates/react/packages/contracts/remappings.txt +3 -9
- package/dist/templates/react/packages/contracts/script/PostDeploy.s.sol +24 -0
- package/dist/templates/react/packages/contracts/src/codegen/Tables.sol +6 -0
- package/dist/templates/react/packages/contracts/src/codegen/tables/Counter.sol +120 -0
- package/dist/templates/react/packages/contracts/src/codegen/world/IIncrementSystem.sol +8 -0
- package/dist/templates/react/packages/contracts/src/codegen/world/IWorld.sol +16 -0
- package/dist/templates/react/packages/contracts/src/systems/IncrementSystem.sol +7 -15
- package/dist/templates/react/packages/contracts/test/CounterTest.t.sol +38 -0
- package/dist/templates/react/packages/contracts/tsconfig.json +9 -8
- package/dist/templates/react/packages/contracts/worlds.json +5 -0
- package/dist/templates/threejs/.eslintrc +10 -0
- package/dist/templates/threejs/.gitignore +1 -0
- package/dist/templates/threejs/.vscode/extensions.json +3 -0
- package/dist/templates/threejs/.vscode/settings.json +3 -0
- package/dist/templates/threejs/package.json +28 -0
- package/dist/templates/threejs/packages/client/.env +1 -0
- package/dist/templates/threejs/packages/client/.eslintrc +7 -0
- package/dist/templates/threejs/packages/client/.gitignore +3 -0
- package/dist/templates/threejs/packages/client/index.html +12 -0
- package/dist/templates/threejs/packages/client/package.json +41 -0
- package/dist/templates/threejs/packages/client/src/App.tsx +81 -0
- package/dist/templates/threejs/packages/client/src/MUDContext.tsx +21 -0
- package/dist/templates/threejs/packages/client/src/index.tsx +19 -0
- package/dist/templates/threejs/packages/client/src/mud/contractComponents.ts +26 -0
- package/dist/templates/threejs/packages/client/src/mud/createClientComponents.ts +10 -0
- package/dist/templates/threejs/packages/client/src/mud/createSystemCalls.ts +15 -0
- package/dist/templates/threejs/packages/client/src/mud/getNetworkConfig.ts +53 -0
- package/dist/templates/threejs/packages/client/src/mud/setup.ts +16 -0
- package/dist/templates/threejs/packages/client/src/mud/setupNetwork.ts +102 -0
- package/dist/templates/threejs/packages/client/src/mud/supportedChains.ts +5 -0
- package/dist/templates/threejs/packages/client/src/mud/world.ts +3 -0
- package/dist/templates/threejs/packages/client/src/useKeyboardMovement.ts +60 -0
- package/dist/templates/threejs/packages/client/tsconfig.json +19 -0
- package/dist/templates/threejs/packages/client/vite.config.ts +15 -0
- package/dist/templates/threejs/packages/contracts/.env +8 -0
- package/dist/templates/threejs/packages/contracts/.gitignore +11 -0
- package/dist/templates/threejs/packages/contracts/.prettierrc +8 -0
- package/dist/templates/threejs/packages/contracts/.solhint.json +12 -0
- package/dist/templates/threejs/packages/contracts/foundry.toml +22 -0
- package/dist/templates/threejs/packages/contracts/mud.config.ts +13 -0
- package/dist/templates/threejs/packages/contracts/package.json +45 -0
- package/dist/templates/threejs/packages/contracts/remappings.txt +3 -0
- package/dist/templates/threejs/packages/contracts/src/codegen/Tables.sol +6 -0
- package/dist/templates/threejs/packages/contracts/src/codegen/tables/Position.sol +263 -0
- package/dist/templates/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +8 -0
- package/dist/templates/threejs/packages/contracts/src/codegen/world/IWorld.sol +16 -0
- package/dist/templates/threejs/packages/contracts/src/systems/MoveSystem.sol +25 -0
- package/dist/templates/threejs/packages/contracts/tsconfig.json +13 -0
- package/dist/templates/threejs/packages/contracts/worlds.json +5 -0
- package/dist/templates/threejs/pnpm-workspace.yaml +2 -0
- package/dist/templates/vanilla/.eslintrc +10 -0
- package/dist/templates/vanilla/.gitignore +1 -0
- package/dist/templates/vanilla/.vscode/extensions.json +3 -0
- package/dist/templates/vanilla/.vscode/settings.json +3 -0
- package/dist/templates/vanilla/package.json +28 -0
- package/dist/templates/vanilla/packages/client/.env +1 -0
- package/dist/templates/vanilla/packages/client/.gitignore +3 -0
- package/dist/templates/vanilla/packages/client/package.json +32 -0
- package/dist/templates/vanilla/packages/client/src/index.ts +22 -0
- package/dist/templates/vanilla/packages/client/src/mud/contractComponents.ts +24 -0
- package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +10 -0
- package/dist/templates/vanilla/packages/client/src/mud/createSystemCalls.ts +21 -0
- package/dist/templates/vanilla/packages/client/src/mud/getNetworkConfig.ts +53 -0
- package/dist/templates/vanilla/packages/client/src/mud/setup.ts +16 -0
- package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +102 -0
- package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +5 -0
- package/dist/templates/vanilla/packages/client/src/mud/world.ts +3 -0
- package/dist/templates/vanilla/packages/client/tsconfig.json +18 -0
- package/dist/templates/{minimal → vanilla}/packages/client/vite.config.ts +3 -0
- package/dist/templates/vanilla/packages/contracts/.env +8 -0
- package/dist/templates/vanilla/packages/contracts/.gitignore +11 -0
- package/dist/templates/vanilla/packages/contracts/.prettierrc +8 -0
- package/dist/templates/vanilla/packages/contracts/.solhint.json +12 -0
- package/dist/templates/vanilla/packages/contracts/foundry.toml +22 -0
- package/dist/templates/vanilla/packages/contracts/mud.config.ts +10 -0
- package/dist/templates/vanilla/packages/contracts/package.json +45 -0
- package/dist/templates/vanilla/packages/contracts/remappings.txt +3 -0
- package/dist/templates/vanilla/packages/contracts/script/PostDeploy.s.sol +24 -0
- package/dist/templates/vanilla/packages/contracts/src/codegen/Tables.sol +6 -0
- package/dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol +120 -0
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +8 -0
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +16 -0
- package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +14 -0
- package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +38 -0
- package/dist/templates/vanilla/packages/contracts/tsconfig.json +13 -0
- package/dist/templates/vanilla/packages/contracts/worlds.json +5 -0
- package/dist/templates/vanilla/pnpm-workspace.yaml +2 -0
- package/package.json +14 -11
- package/dist/templates/minimal/package.json +0 -18
- package/dist/templates/minimal/packages/client/package.json +0 -37
- package/dist/templates/minimal/packages/client/src/config.ts +0 -22
- package/dist/templates/minimal/packages/client/src/index.ts +0 -37
- package/dist/templates/minimal/packages/contracts/chainSpec.json +0 -5
- package/dist/templates/minimal/packages/contracts/deploy.json +0 -4
- package/dist/templates/minimal/packages/contracts/exports.sh +0 -22
- package/dist/templates/minimal/packages/contracts/foundry.toml +0 -11
- package/dist/templates/minimal/packages/contracts/package.json +0 -40
- package/dist/templates/minimal/packages/contracts/remappings.txt +0 -9
- package/dist/templates/minimal/packages/contracts/src/components/CounterComponent.sol +0 -9
- package/dist/templates/minimal/packages/contracts/src/libraries/LibMath.sol +0 -10
- package/dist/templates/minimal/packages/contracts/src/systems/IncrementSystem.sol +0 -22
- package/dist/templates/minimal/packages/contracts/src/systems/README.md +0 -7
- package/dist/templates/minimal/packages/contracts/src/test/Deploy.sol +0 -19
- package/dist/templates/minimal/packages/contracts/src/test/Deploy.t.sol +0 -14
- package/dist/templates/minimal/packages/contracts/src/test/LibDeploy.sol +0 -22
- package/dist/templates/minimal/packages/contracts/tsconfig.json +0 -12
- package/dist/templates/react/packages/client/src/config.ts +0 -22
- package/dist/templates/react/packages/contracts/chainSpec.json +0 -5
- package/dist/templates/react/packages/contracts/deploy.json +0 -4
- package/dist/templates/react/packages/contracts/exports.sh +0 -22
- package/dist/templates/react/packages/contracts/src/components/CounterComponent.sol +0 -9
- package/dist/templates/react/packages/contracts/src/libraries/LibMath.sol +0 -10
- package/dist/templates/react/packages/contracts/src/systems/README.md +0 -7
- package/dist/templates/react/packages/contracts/src/test/Deploy.sol +0 -19
- package/dist/templates/react/packages/contracts/src/test/Deploy.t.sol +0 -14
- package/dist/templates/react/packages/contracts/src/test/LibDeploy.sol +0 -22
- /package/dist/templates/{minimal → phaser}/.gitignore +0 -0
- /package/dist/templates/{minimal → phaser}/.vscode/extensions.json +0 -0
- /package/dist/templates/{minimal → phaser}/.vscode/settings.json +0 -0
- /package/dist/templates/{minimal → phaser}/packages/client/.gitignore +0 -0
- /package/dist/templates/{minimal → phaser}/packages/contracts/.prettierrc +0 -0
- /package/dist/templates/{minimal → phaser}/pnpm-workspace.yaml +0 -0
- /package/dist/templates/{minimal → vanilla}/packages/client/index.html +0 -0
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { setupMUDNetwork } from "@latticexyz/std-client";
|
|
2
|
-
import { createWorld } from "@latticexyz/recs";
|
|
3
|
-
import { SystemTypes } from "contracts/types/SystemTypes";
|
|
4
|
-
import { SystemAbis } from "contracts/types/SystemAbis.mjs";
|
|
5
|
-
import { defineNumberComponent } from "@latticexyz/std-client";
|
|
6
|
-
import { config } from "./config";
|
|
7
|
-
|
|
8
|
-
// The world contains references to all entities, all components and disposers.
|
|
9
|
-
const world = createWorld();
|
|
10
|
-
|
|
11
|
-
// Components contain the application state.
|
|
12
|
-
// If a contractId is provided, MUD syncs the state with the corresponding
|
|
13
|
-
// component contract (in this case `CounterComponent.sol`)
|
|
14
|
-
const components = {
|
|
15
|
-
Counter: defineNumberComponent(world, {
|
|
16
|
-
metadata: {
|
|
17
|
-
contractId: "component.Counter",
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Components expose a stream that triggers when the component is updated.
|
|
23
|
-
components.Counter.update$.subscribe(({ value }) => {
|
|
24
|
-
document.getElementById("counter")!.innerHTML = String(value?.[0]?.value);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// This is where the magic happens
|
|
28
|
-
setupMUDNetwork<typeof components, SystemTypes>(config, world, components, SystemAbis).then(
|
|
29
|
-
({ startSync, systems }) => {
|
|
30
|
-
// After setting up the network, we can tell MUD to start the synchronization process.
|
|
31
|
-
startSync();
|
|
32
|
-
|
|
33
|
-
// Just for demonstration purposes: we create a global function that can be
|
|
34
|
-
// called to invoke the Increment system contract. (See IncrementSystem.sol.)
|
|
35
|
-
(window as any).increment = () => systems["system.Increment"].executeTyped("0x00");
|
|
36
|
-
}
|
|
37
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#! usr/bin/bash
|
|
2
|
-
ABIS=(
|
|
3
|
-
# Add greps to export here
|
|
4
|
-
*Component
|
|
5
|
-
*System
|
|
6
|
-
World
|
|
7
|
-
LibQuery
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
EXCLUDE=(
|
|
11
|
-
# Add files not to export here
|
|
12
|
-
Component
|
|
13
|
-
IComponent
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
for file in ${ABIS[@]}; do
|
|
17
|
-
cp out/$file.sol/*.json abi/;
|
|
18
|
-
done
|
|
19
|
-
|
|
20
|
-
for file in ${EXCLUDE[@]}; do
|
|
21
|
-
rm abi/$file.json;
|
|
22
|
-
done
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "contracts",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "mud types",
|
|
8
|
-
"deploy": "mud deploy-contracts",
|
|
9
|
-
"dev": "mud deploy-contracts --dev --watch --openUrl http://localhost:3000?cache=false",
|
|
10
|
-
"devnode": "mud devnode",
|
|
11
|
-
"lint": "prettier && solhint",
|
|
12
|
-
"prettier": "prettier --write 'src/**/*.sol'",
|
|
13
|
-
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
|
|
14
|
-
"test": "mud test",
|
|
15
|
-
"types": "mud types"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@ethersproject/abi": "^5.7.0",
|
|
19
|
-
"@ethersproject/bytes": "^5.7.0",
|
|
20
|
-
"@ethersproject/providers": "^5.7.2",
|
|
21
|
-
"@latticexyz/cli": "{{mud-version}}",
|
|
22
|
-
"@latticexyz/solecs": "{{mud-version}}",
|
|
23
|
-
"@latticexyz/std-contracts": "{{mud-version}}",
|
|
24
|
-
"@solidstate/contracts": "^0.0.52",
|
|
25
|
-
"@typechain/ethers-v5": "^10.2.0",
|
|
26
|
-
"@types/node": "^18.11.9",
|
|
27
|
-
"ds-test": "https://github.com/dapphub/ds-test.git#c9ce3f25bde29fc5eb9901842bf02850dfd2d084",
|
|
28
|
-
"ethers": "^5.7.2",
|
|
29
|
-
"forge-std": "https://github.com/foundry-rs/forge-std.git#b4f121555729b3afb3c5ffccb62ff4b6e2818fd3",
|
|
30
|
-
"memmove": "https://github.com/brockelmore/memmove.git#ffd71cd77b1708574ef46a667b23ca3a5cc9fa27",
|
|
31
|
-
"prettier": "^2.8.4",
|
|
32
|
-
"prettier-plugin-solidity": "^1.1.2",
|
|
33
|
-
"rimraf": "^3.0.2",
|
|
34
|
-
"run-pty": "^4.0.3",
|
|
35
|
-
"solhint": "^3.3.7",
|
|
36
|
-
"typechain": "^8.1.1",
|
|
37
|
-
"typescript": "^4.9.5",
|
|
38
|
-
"wait-on": "^6.0.1"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
components/=./src/components
|
|
2
|
-
systems/=./src/systems
|
|
3
|
-
libraries/=./src/libraries
|
|
4
|
-
std-contracts/=node_modules/@latticexyz/std-contracts/src/
|
|
5
|
-
solecs/=node_modules/@latticexyz/solecs/src/
|
|
6
|
-
memmove/=node_modules/memmove/src/
|
|
7
|
-
ds-test/=node_modules/ds-test/src/
|
|
8
|
-
forge-std/=node_modules/forge-std/src/
|
|
9
|
-
@solidstate/=node_modules/@solidstate/
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
import "std-contracts/components/Uint32Component.sol";
|
|
4
|
-
|
|
5
|
-
uint256 constant ID = uint256(keccak256("component.Counter"));
|
|
6
|
-
|
|
7
|
-
contract CounterComponent is Uint32Component {
|
|
8
|
-
constructor(address world) Uint32Component(world, ID) {}
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
import { Uint32Component } from "std-contracts/components/Uint32Component.sol";
|
|
4
|
-
|
|
5
|
-
library LibMath {
|
|
6
|
-
function increment(Uint32Component component, uint256 entity) internal {
|
|
7
|
-
uint32 current = component.has(entity) ? component.getValue(entity) : 0;
|
|
8
|
-
component.set(entity, current + 1);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
import { System, IWorld } from "solecs/System.sol";
|
|
4
|
-
import { getAddressById } from "solecs/utils.sol";
|
|
5
|
-
import { CounterComponent, ID as CounterComponentID } from "components/CounterComponent.sol";
|
|
6
|
-
import { LibMath } from "libraries/LibMath.sol";
|
|
7
|
-
|
|
8
|
-
uint256 constant ID = uint256(keccak256("system.Increment"));
|
|
9
|
-
|
|
10
|
-
contract IncrementSystem is System {
|
|
11
|
-
constructor(IWorld _world, address _components) System(_world, _components) {}
|
|
12
|
-
|
|
13
|
-
function execute(bytes memory arguments) public returns (bytes memory) {
|
|
14
|
-
uint256 entity = abi.decode(arguments, (uint256));
|
|
15
|
-
CounterComponent c = CounterComponent(getAddressById(components, CounterComponentID));
|
|
16
|
-
LibMath.increment(c, entity);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function executeTyped(uint256 entity) public returns (bytes memory) {
|
|
20
|
-
return execute(abi.encode(entity));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Systems
|
|
2
|
-
|
|
3
|
-
In order to automatically generate system abi and type maps (using `mud system-types`), systems must follow some rules:
|
|
4
|
-
|
|
5
|
-
- Systems must implement the `ISystem` interface.
|
|
6
|
-
- Systems must declare an ID following this pattern: `uint256 constant ID = uint256(keccak256("<UNIQUE SYSTEM IDENTIFIER>"));`
|
|
7
|
-
- System contracts must be named exactly the same as the file containing them.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
import { IDeploy } from "std-contracts/test/MudTest.t.sol";
|
|
5
|
-
import { Vm } from "forge-std/Vm.sol";
|
|
6
|
-
import { IWorld } from "solecs/interfaces/IWorld.sol";
|
|
7
|
-
import { LibDeploy, DeployResult } from "./LibDeploy.sol";
|
|
8
|
-
|
|
9
|
-
contract Deploy is IDeploy {
|
|
10
|
-
address constant HEVM_ADDRESS = address(bytes20(uint160(uint256(keccak256("hevm cheat code")))));
|
|
11
|
-
Vm internal immutable vm = Vm(HEVM_ADDRESS);
|
|
12
|
-
|
|
13
|
-
function deploy(address deployer) external returns (IWorld world) {
|
|
14
|
-
vm.startPrank(deployer);
|
|
15
|
-
DeployResult memory result = LibDeploy.deploy(deployer, address(0), false);
|
|
16
|
-
world = result.world;
|
|
17
|
-
vm.stopPrank();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
import { Deploy } from "./Deploy.sol";
|
|
5
|
-
import "std-contracts/test/MudTest.t.sol";
|
|
6
|
-
|
|
7
|
-
contract DeployTest is MudTest {
|
|
8
|
-
constructor() MudTest(new Deploy()) {}
|
|
9
|
-
|
|
10
|
-
function testDeploy() public view {
|
|
11
|
-
console.log("Deployer");
|
|
12
|
-
console.log(deployer);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
// @NOTE: DO NOT EDIT!
|
|
5
|
-
// This file is a stub for LibDeploy.json to make imports work.
|
|
6
|
-
// The real LibDeploy.json is generated automatically when deploying
|
|
7
|
-
// via `mud deploy` or testing via `mud test`
|
|
8
|
-
|
|
9
|
-
import { World } from "solecs/World.sol";
|
|
10
|
-
|
|
11
|
-
struct DeployResult {
|
|
12
|
-
World world;
|
|
13
|
-
address deployer;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
library LibDeploy {
|
|
17
|
-
function deploy(
|
|
18
|
-
address _deployer,
|
|
19
|
-
address _world,
|
|
20
|
-
bool _reuseComponents
|
|
21
|
-
) internal returns (DeployResult memory result) {}
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Visit https://aka.ms/tsconfig.json for all config options
|
|
2
|
-
{
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "ES2020",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"resolveJsonModule": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SetupContractConfig } from "@latticexyz/std-client";
|
|
2
|
-
import { Wallet } from "ethers";
|
|
3
|
-
const params = new URLSearchParams(window.location.search);
|
|
4
|
-
|
|
5
|
-
export const config: SetupContractConfig = {
|
|
6
|
-
clock: {
|
|
7
|
-
period: 1000,
|
|
8
|
-
initialTime: 0,
|
|
9
|
-
syncInterval: 5000,
|
|
10
|
-
},
|
|
11
|
-
provider: {
|
|
12
|
-
jsonRpcUrl: params.get("rpc") ?? "http://localhost:8545",
|
|
13
|
-
wsRpcUrl: params.get("wsRpc") ?? "ws://localhost:8545",
|
|
14
|
-
chainId: Number(params.get("chainId")) || 31337,
|
|
15
|
-
},
|
|
16
|
-
privateKey: Wallet.createRandom().privateKey,
|
|
17
|
-
chainId: Number(params.get("chainId")) || 31337,
|
|
18
|
-
snapshotServiceUrl: params.get("snapshot") ?? undefined,
|
|
19
|
-
initialBlockNumber: Number(params.get("initialBlockNumber")) || 0,
|
|
20
|
-
worldAddress: params.get("worldAddress")!,
|
|
21
|
-
disableCache: params.get("cache") === "false",
|
|
22
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#! usr/bin/bash
|
|
2
|
-
ABIS=(
|
|
3
|
-
# Add greps to export here
|
|
4
|
-
*Component
|
|
5
|
-
*System
|
|
6
|
-
World
|
|
7
|
-
LibQuery
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
EXCLUDE=(
|
|
11
|
-
# Add files not to export here
|
|
12
|
-
Component
|
|
13
|
-
IComponent
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
for file in ${ABIS[@]}; do
|
|
17
|
-
cp out/$file.sol/*.json abi/;
|
|
18
|
-
done
|
|
19
|
-
|
|
20
|
-
for file in ${EXCLUDE[@]}; do
|
|
21
|
-
rm abi/$file.json;
|
|
22
|
-
done
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
import "std-contracts/components/Uint32Component.sol";
|
|
4
|
-
|
|
5
|
-
uint256 constant ID = uint256(keccak256("component.Counter"));
|
|
6
|
-
|
|
7
|
-
contract CounterComponent is Uint32Component {
|
|
8
|
-
constructor(address world) Uint32Component(world, ID) {}
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
import { Uint32Component } from "std-contracts/components/Uint32Component.sol";
|
|
4
|
-
|
|
5
|
-
library LibMath {
|
|
6
|
-
function increment(Uint32Component component, uint256 entity) internal {
|
|
7
|
-
uint32 current = component.has(entity) ? component.getValue(entity) : 0;
|
|
8
|
-
component.set(entity, current + 1);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Systems
|
|
2
|
-
|
|
3
|
-
In order to automatically generate system abi and type maps (using `mud system-types`), systems must follow some rules:
|
|
4
|
-
|
|
5
|
-
- Systems must implement the `ISystem` interface.
|
|
6
|
-
- Systems must declare an ID following this pattern: `uint256 constant ID = uint256(keccak256("<UNIQUE SYSTEM IDENTIFIER>"));`
|
|
7
|
-
- System contracts must be named exactly the same as the file containing them.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
import { IDeploy } from "std-contracts/test/MudTest.t.sol";
|
|
5
|
-
import { Vm } from "forge-std/Vm.sol";
|
|
6
|
-
import { IWorld } from "solecs/interfaces/IWorld.sol";
|
|
7
|
-
import { LibDeploy, DeployResult } from "./LibDeploy.sol";
|
|
8
|
-
|
|
9
|
-
contract Deploy is IDeploy {
|
|
10
|
-
address constant HEVM_ADDRESS = address(bytes20(uint160(uint256(keccak256("hevm cheat code")))));
|
|
11
|
-
Vm internal immutable vm = Vm(HEVM_ADDRESS);
|
|
12
|
-
|
|
13
|
-
function deploy(address deployer) external returns (IWorld world) {
|
|
14
|
-
vm.startPrank(deployer);
|
|
15
|
-
DeployResult memory result = LibDeploy.deploy(deployer, address(0), false);
|
|
16
|
-
world = result.world;
|
|
17
|
-
vm.stopPrank();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
import { Deploy } from "./Deploy.sol";
|
|
5
|
-
import "std-contracts/test/MudTest.t.sol";
|
|
6
|
-
|
|
7
|
-
contract DeployTest is MudTest {
|
|
8
|
-
constructor() MudTest(new Deploy()) {}
|
|
9
|
-
|
|
10
|
-
function testDeploy() public view {
|
|
11
|
-
console.log("Deployer");
|
|
12
|
-
console.log(deployer);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity >=0.8.0;
|
|
3
|
-
|
|
4
|
-
// @NOTE: DO NOT EDIT!
|
|
5
|
-
// This file is a stub for LibDeploy.json to make imports work.
|
|
6
|
-
// The real LibDeploy.json is generated automatically when deploying
|
|
7
|
-
// via `mud deploy` or testing via `mud test`
|
|
8
|
-
|
|
9
|
-
import { World } from "solecs/World.sol";
|
|
10
|
-
|
|
11
|
-
struct DeployResult {
|
|
12
|
-
World world;
|
|
13
|
-
address deployer;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
library LibDeploy {
|
|
17
|
-
function deploy(
|
|
18
|
-
address _deployer,
|
|
19
|
-
address _world,
|
|
20
|
-
bool _reuseComponents
|
|
21
|
-
) internal returns (DeployResult memory result) {}
|
|
22
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|