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
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { setupMUDV2Network } from "@latticexyz/std-client";
|
|
2
|
+
import { createFastTxExecutor, createFaucetService, getSnapSyncRecords } from "@latticexyz/network";
|
|
3
|
+
import { getNetworkConfig } from "./getNetworkConfig";
|
|
4
|
+
import { defineContractComponents } from "./contractComponents";
|
|
5
|
+
import { world } from "./world";
|
|
6
|
+
import { Contract, Signer, utils } from "ethers";
|
|
7
|
+
import { JsonRpcProvider } from "@ethersproject/providers";
|
|
8
|
+
import { IWorld__factory } from "contracts/types/ethers-contracts/factories/IWorld__factory";
|
|
9
|
+
import { getTableIds } from "@latticexyz/utils";
|
|
10
|
+
import storeConfig from "contracts/mud.config";
|
|
11
|
+
|
|
12
|
+
export type SetupNetworkResult = Awaited<ReturnType<typeof setupNetwork>>;
|
|
13
|
+
|
|
14
|
+
export async function setupNetwork() {
|
|
15
|
+
const contractComponents = defineContractComponents(world);
|
|
16
|
+
const networkConfig = await getNetworkConfig();
|
|
17
|
+
const result = await setupMUDV2Network<typeof contractComponents, typeof storeConfig>({
|
|
18
|
+
networkConfig,
|
|
19
|
+
world,
|
|
20
|
+
contractComponents,
|
|
21
|
+
syncThread: "main",
|
|
22
|
+
storeConfig,
|
|
23
|
+
worldAbi: IWorld__factory.abi,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Request drip from faucet
|
|
27
|
+
const signer = result.network.signer.get();
|
|
28
|
+
if (networkConfig.faucetServiceUrl && signer) {
|
|
29
|
+
const address = await signer.getAddress();
|
|
30
|
+
console.info("[Dev Faucet]: Player address -> ", address);
|
|
31
|
+
|
|
32
|
+
const faucet = createFaucetService(networkConfig.faucetServiceUrl);
|
|
33
|
+
|
|
34
|
+
const requestDrip = async () => {
|
|
35
|
+
const balance = await signer.getBalance();
|
|
36
|
+
console.info(`[Dev Faucet]: Player balance -> ${balance}`);
|
|
37
|
+
const lowBalance = balance?.lte(utils.parseEther("1"));
|
|
38
|
+
if (lowBalance) {
|
|
39
|
+
console.info("[Dev Faucet]: Balance is low, dripping funds to player");
|
|
40
|
+
// Double drip
|
|
41
|
+
await faucet.dripDev({ address });
|
|
42
|
+
await faucet.dripDev({ address });
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
requestDrip();
|
|
47
|
+
// Request a drip every 20 seconds
|
|
48
|
+
setInterval(requestDrip, 20000);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const provider = result.network.providers.get().json;
|
|
52
|
+
const signerOrProvider = signer ?? provider;
|
|
53
|
+
// Create a World contract instance
|
|
54
|
+
const worldContract = IWorld__factory.connect(networkConfig.worldAddress, signerOrProvider);
|
|
55
|
+
|
|
56
|
+
if (networkConfig.snapSync) {
|
|
57
|
+
const currentBlockNumber = await provider.getBlockNumber();
|
|
58
|
+
const tableRecords = await getSnapSyncRecords(
|
|
59
|
+
networkConfig.worldAddress,
|
|
60
|
+
getTableIds(storeConfig),
|
|
61
|
+
currentBlockNumber,
|
|
62
|
+
signerOrProvider
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
console.log(`Syncing ${tableRecords.length} records`);
|
|
66
|
+
result.startSync(tableRecords, currentBlockNumber);
|
|
67
|
+
} else {
|
|
68
|
+
result.startSync();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Create a fast tx executor
|
|
72
|
+
const fastTxExecutor =
|
|
73
|
+
signer?.provider instanceof JsonRpcProvider
|
|
74
|
+
? await createFastTxExecutor(signer as Signer & { provider: JsonRpcProvider })
|
|
75
|
+
: null;
|
|
76
|
+
|
|
77
|
+
// TODO: infer this from fastTxExecute signature?
|
|
78
|
+
type BoundFastTxExecuteFn<C extends Contract> = <F extends keyof C>(
|
|
79
|
+
func: F,
|
|
80
|
+
args: Parameters<C[F]>,
|
|
81
|
+
options?: {
|
|
82
|
+
retryCount?: number;
|
|
83
|
+
}
|
|
84
|
+
) => Promise<ReturnType<C[F]>>;
|
|
85
|
+
|
|
86
|
+
function bindFastTxExecute<C extends Contract>(contract: C): BoundFastTxExecuteFn<C> {
|
|
87
|
+
return async function (...args) {
|
|
88
|
+
if (!fastTxExecutor) {
|
|
89
|
+
throw new Error("no signer");
|
|
90
|
+
}
|
|
91
|
+
const { tx } = await fastTxExecutor.fastTxExecute(contract, ...args);
|
|
92
|
+
return await tx;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
...result,
|
|
98
|
+
worldContract,
|
|
99
|
+
worldSend: bindFastTxExecute(worldContract),
|
|
100
|
+
fastTxExecutor,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MUDChain, latticeTestnet } from "@latticexyz/common/chains";
|
|
2
|
+
import { foundry } from "@wagmi/chains";
|
|
3
|
+
|
|
4
|
+
// If you are deploying to chains other than anvil or Lattice testnet, add them here
|
|
5
|
+
export const supportedChains: MUDChain[] = [foundry, latticeTestnet];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"types": ["vite/client"],
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"lib": ["ESNext", "DOM"],
|
|
8
|
+
"moduleResolution": "Node",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"jsx": "react-jsx"
|
|
16
|
+
},
|
|
17
|
+
"include": ["src"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 enviroment, but we're including this here for ease of local
|
|
5
|
+
# development. Please do not commit changes to this file!
|
|
6
|
+
#
|
|
7
|
+
# Anvil default private key:
|
|
8
|
+
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["solhint:recommended", "mud"],
|
|
3
|
+
"plugins": ["mud"],
|
|
4
|
+
"rules": {
|
|
5
|
+
"compiler-version": ["error", ">=0.8.0"],
|
|
6
|
+
"avoid-low-level-calls": "off",
|
|
7
|
+
"no-inline-assembly": "off",
|
|
8
|
+
"func-visibility": ["warn", { "ignoreConstructors": true }],
|
|
9
|
+
"no-empty-blocks": "off",
|
|
10
|
+
"no-complex-fallback": "off"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[profile.default]
|
|
2
|
+
solc_version = "0.8.13"
|
|
3
|
+
ffi = false
|
|
4
|
+
fuzz_runs = 256
|
|
5
|
+
optimizer = true
|
|
6
|
+
optimizer_runs = 3000
|
|
7
|
+
verbosity = 2
|
|
8
|
+
src = "src"
|
|
9
|
+
test = "test"
|
|
10
|
+
out = "out"
|
|
11
|
+
allow_paths = ["../../node_modules", "../../../../packages"]
|
|
12
|
+
extra_output_files = [
|
|
13
|
+
"abi",
|
|
14
|
+
"evm.bytecode"
|
|
15
|
+
]
|
|
16
|
+
fs_permissions = [{ access = "read", path = "./"}]
|
|
17
|
+
|
|
18
|
+
[profile.lattice-testnet]
|
|
19
|
+
eth_rpc_url = "https://follower.testnet-chain.linfra.xyz"
|
|
20
|
+
|
|
21
|
+
[profile.hackathon-testnet]
|
|
22
|
+
eth_rpc_url = "https://lattice-goerli-sequencer.optimism.io"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "contracts",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "forge clean && forge build",
|
|
8
|
+
"deploy": "pnpm run initialize && mud deploy",
|
|
9
|
+
"deploy:hackathon": "pnpm run initialize && mud deploy --profile=hackathon-testnet",
|
|
10
|
+
"deploy:testnet": "pnpm run initialize && mud deploy --profile=lattice-testnet",
|
|
11
|
+
"dev": "pnpm mud dev-contracts --tsgenOutput ../client/src/mud",
|
|
12
|
+
"initialize": "pnpm run tablegen && pnpm run worldgen && pnpm run build && pnpm run worldtypes && pnpm run tsgen",
|
|
13
|
+
"lint": "pnpm run prettier && pnpm run solhint",
|
|
14
|
+
"prettier": "prettier --write 'src/**/*.sol'",
|
|
15
|
+
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
|
|
16
|
+
"tablegen": "mud tablegen",
|
|
17
|
+
"test": "tsc --noEmit && mud test",
|
|
18
|
+
"tsgen": "mud tsgen --configPath mud.config.ts --out ../client/src/mud",
|
|
19
|
+
"worldgen": "mud worldgen",
|
|
20
|
+
"worldtypes": "rimraf types && typechain --target=ethers-v5 out/IWorld.sol/IWorld.json"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ethersproject/abi": "^5.7.0",
|
|
24
|
+
"@ethersproject/bytes": "^5.7.0",
|
|
25
|
+
"@ethersproject/providers": "^5.7.2",
|
|
26
|
+
"@latticexyz/cli": "{{mud-version}}",
|
|
27
|
+
"@latticexyz/schema-type": "{{mud-version}}",
|
|
28
|
+
"@latticexyz/std-contracts": "{{mud-version}}",
|
|
29
|
+
"@latticexyz/store": "{{mud-version}}",
|
|
30
|
+
"@latticexyz/world": "{{mud-version}}",
|
|
31
|
+
"ethers": "^5.7.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@typechain/ethers-v5": "^10.2.0",
|
|
35
|
+
"@types/node": "^18.15.11",
|
|
36
|
+
"ds-test": "https://github.com/dapphub/ds-test.git#c9ce3f25bde29fc5eb9901842bf02850dfd2d084",
|
|
37
|
+
"forge-std": "https://github.com/foundry-rs/forge-std.git#b4f121555729b3afb3c5ffccb62ff4b6e2818fd3",
|
|
38
|
+
"prettier": "^2.6.2",
|
|
39
|
+
"prettier-plugin-solidity": "^1.0.0-beta.19",
|
|
40
|
+
"solhint": "^3.3.7",
|
|
41
|
+
"solhint-config-mud": "{{mud-version}}",
|
|
42
|
+
"solhint-plugin-mud": "{{mud-version}}",
|
|
43
|
+
"typechain": "^8.1.1"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import { Script } from "forge-std/Script.sol";
|
|
5
|
+
import { console } from "forge-std/console.sol";
|
|
6
|
+
import { IWorld } from "../src/codegen/world/IWorld.sol";
|
|
7
|
+
|
|
8
|
+
contract PostDeploy is Script {
|
|
9
|
+
function run(address worldAddress) external {
|
|
10
|
+
// Load the private key from the `PRIVATE_KEY` environment variable (in .env)
|
|
11
|
+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
|
|
12
|
+
|
|
13
|
+
// Start broadcasting transactions from the deployer account
|
|
14
|
+
vm.startBroadcast(deployerPrivateKey);
|
|
15
|
+
|
|
16
|
+
// ------------------ EXAMPLES ------------------
|
|
17
|
+
|
|
18
|
+
// Call increment on the world via the registered function selector
|
|
19
|
+
uint32 newValue = IWorld(worldAddress).increment();
|
|
20
|
+
console.log("Increment via IWorld:", newValue);
|
|
21
|
+
|
|
22
|
+
vm.stopBroadcast();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
// Import schema type
|
|
7
|
+
import { SchemaType } from "@latticexyz/schema-type/src/solidity/SchemaType.sol";
|
|
8
|
+
|
|
9
|
+
// Import store internals
|
|
10
|
+
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
|
11
|
+
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
|
12
|
+
import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
|
|
13
|
+
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
|
14
|
+
import { Memory } from "@latticexyz/store/src/Memory.sol";
|
|
15
|
+
import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
16
|
+
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
|
17
|
+
import { Schema, SchemaLib } from "@latticexyz/store/src/Schema.sol";
|
|
18
|
+
import { PackedCounter, PackedCounterLib } from "@latticexyz/store/src/PackedCounter.sol";
|
|
19
|
+
|
|
20
|
+
bytes32 constant _tableId = bytes32(abi.encodePacked(bytes16(""), bytes16("Counter")));
|
|
21
|
+
bytes32 constant CounterTableId = _tableId;
|
|
22
|
+
|
|
23
|
+
library Counter {
|
|
24
|
+
/** Get the table's schema */
|
|
25
|
+
function getSchema() internal pure returns (Schema) {
|
|
26
|
+
SchemaType[] memory _schema = new SchemaType[](1);
|
|
27
|
+
_schema[0] = SchemaType.UINT32;
|
|
28
|
+
|
|
29
|
+
return SchemaLib.encode(_schema);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getKeySchema() internal pure returns (Schema) {
|
|
33
|
+
SchemaType[] memory _schema = new SchemaType[](0);
|
|
34
|
+
|
|
35
|
+
return SchemaLib.encode(_schema);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Get the table's metadata */
|
|
39
|
+
function getMetadata() internal pure returns (string memory, string[] memory) {
|
|
40
|
+
string[] memory _fieldNames = new string[](1);
|
|
41
|
+
_fieldNames[0] = "value";
|
|
42
|
+
return ("Counter", _fieldNames);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Register the table's schema */
|
|
46
|
+
function registerSchema() internal {
|
|
47
|
+
StoreSwitch.registerSchema(_tableId, getSchema(), getKeySchema());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Register the table's schema (using the specified store) */
|
|
51
|
+
function registerSchema(IStore _store) internal {
|
|
52
|
+
_store.registerSchema(_tableId, getSchema(), getKeySchema());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Set the table's metadata */
|
|
56
|
+
function setMetadata() internal {
|
|
57
|
+
(string memory _tableName, string[] memory _fieldNames) = getMetadata();
|
|
58
|
+
StoreSwitch.setMetadata(_tableId, _tableName, _fieldNames);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Set the table's metadata (using the specified store) */
|
|
62
|
+
function setMetadata(IStore _store) internal {
|
|
63
|
+
(string memory _tableName, string[] memory _fieldNames) = getMetadata();
|
|
64
|
+
_store.setMetadata(_tableId, _tableName, _fieldNames);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Get value */
|
|
68
|
+
function get() internal view returns (uint32 value) {
|
|
69
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
70
|
+
|
|
71
|
+
bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 0);
|
|
72
|
+
return (uint32(Bytes.slice4(_blob, 0)));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Get value (using the specified store) */
|
|
76
|
+
function get(IStore _store) internal view returns (uint32 value) {
|
|
77
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
78
|
+
|
|
79
|
+
bytes memory _blob = _store.getField(_tableId, _keyTuple, 0);
|
|
80
|
+
return (uint32(Bytes.slice4(_blob, 0)));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Set value */
|
|
84
|
+
function set(uint32 value) internal {
|
|
85
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
86
|
+
|
|
87
|
+
StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Set value (using the specified store) */
|
|
91
|
+
function set(IStore _store, uint32 value) internal {
|
|
92
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
93
|
+
|
|
94
|
+
_store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Tightly pack full data using this table's schema */
|
|
98
|
+
function encode(uint32 value) internal view returns (bytes memory) {
|
|
99
|
+
return abi.encodePacked(value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Encode keys as a bytes32 array using this table's schema */
|
|
103
|
+
function encodeKeyTuple() internal pure returns (bytes32[] memory _keyTuple) {
|
|
104
|
+
_keyTuple = new bytes32[](0);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Delete all data for given keys */
|
|
108
|
+
function deleteRecord() internal {
|
|
109
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
110
|
+
|
|
111
|
+
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Delete all data for given keys (using the specified store) */
|
|
115
|
+
function deleteRecord(IStore _store) internal {
|
|
116
|
+
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
117
|
+
|
|
118
|
+
_store.deleteRecord(_tableId, _keyTuple);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
import { IBaseWorld } from "@latticexyz/world/src/interfaces/IBaseWorld.sol";
|
|
7
|
+
|
|
8
|
+
import { IIncrementSystem } from "./IIncrementSystem.sol";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The IWorld interface includes all systems dynamically added to the World
|
|
12
|
+
* during the deploy process.
|
|
13
|
+
*/
|
|
14
|
+
interface IWorld is IBaseWorld, IIncrementSystem {
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import { System } from "@latticexyz/world/src/System.sol";
|
|
5
|
+
import { Counter } from "../codegen/Tables.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,38 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "forge-std/Test.sol";
|
|
5
|
+
import { MudV2Test } from "@latticexyz/std-contracts/src/test/MudV2Test.t.sol";
|
|
6
|
+
import { getKeysWithValue } from "@latticexyz/world/src/modules/keyswithvalue/getKeysWithValue.sol";
|
|
7
|
+
|
|
8
|
+
import { IWorld } from "../src/codegen/world/IWorld.sol";
|
|
9
|
+
import { Counter, CounterTableId } from "../src/codegen/Tables.sol";
|
|
10
|
+
|
|
11
|
+
contract CounterTest is MudV2Test {
|
|
12
|
+
IWorld public world;
|
|
13
|
+
|
|
14
|
+
function setUp() public override {
|
|
15
|
+
super.setUp();
|
|
16
|
+
world = IWorld(worldAddress);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function testWorldExists() public {
|
|
20
|
+
uint256 codeSize;
|
|
21
|
+
address addr = worldAddress;
|
|
22
|
+
assembly {
|
|
23
|
+
codeSize := extcodesize(addr)
|
|
24
|
+
}
|
|
25
|
+
assertTrue(codeSize > 0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function testCounter() public {
|
|
29
|
+
// Expect the counter to be 1 because it was incremented in the PostDeploy script.
|
|
30
|
+
uint32 counter = Counter.get(world);
|
|
31
|
+
assertEq(counter, 1);
|
|
32
|
+
|
|
33
|
+
// Expect the counter to be 2 after calling increment.
|
|
34
|
+
world.increment();
|
|
35
|
+
counter = Counter.get(world);
|
|
36
|
+
assertEq(counter, 2);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
"moduleResolution": "node"
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mud",
|
|
3
|
-
"version": "2.0.0-alpha.1.
|
|
3
|
+
"version": "2.0.0-alpha.1.211+80a9a33b",
|
|
4
4
|
"description": "Create a new MUD project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lattice <mud@lattice.xyz>",
|
|
@@ -9,26 +9,29 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"build": "pnpm run build:js",
|
|
13
|
+
"build:js": "tsup && ./scripts/copy-templates.sh",
|
|
14
|
+
"clean": "pnpm run clean:js",
|
|
15
|
+
"clean:js": "rimraf dist",
|
|
16
|
+
"dev": "tsup --watch",
|
|
15
17
|
"prepublishOnly": "npm run clean && npm run build",
|
|
16
|
-
"
|
|
17
|
-
"test": "
|
|
18
|
-
"test:
|
|
19
|
-
"test:
|
|
18
|
+
"test": "pnpm run test:vanilla && pnpm run test:react && pnpm run test:phaser && pnpm run test:threejs",
|
|
19
|
+
"test:phaser": "dist/cli.js test-project --template phaser && rimraf test-project",
|
|
20
|
+
"test:react": "dist/cli.js test-project --template react && rimraf test-project",
|
|
21
|
+
"test:threejs": "dist/cli.js test-project --template threejs && rimraf test-project",
|
|
22
|
+
"test:vanilla": "dist/cli.js test-project --template vanilla && rimraf test-project"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"create-create-app": "git+https://github.com/holic/create-create-app#74376c59b48a04aabbe94d9cacfe9cb1cecccd63"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^
|
|
26
|
-
"tsup": "^
|
|
28
|
+
"@types/node": "^18.15.11",
|
|
29
|
+
"tsup": "^6.7.0",
|
|
27
30
|
"typescript": "^4.9.5"
|
|
28
31
|
},
|
|
29
32
|
"publishConfig": {
|
|
30
33
|
"access": "public",
|
|
31
34
|
"registry": "https://registry.npmjs.org"
|
|
32
35
|
},
|
|
33
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "80a9a33bc79f22d347f72c7ba9d99a11f40e7fcd"
|
|
34
37
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mud-template-minimal",
|
|
3
|
-
"private": true,
|
|
4
|
-
"scripts": {
|
|
5
|
-
"build": "pnpm recursive run build",
|
|
6
|
-
"dev": "run-pty % pnpm dev:node % pnpm dev:client % pnpm dev:contracts",
|
|
7
|
-
"dev:client": "pnpm --filter 'client' run dev",
|
|
8
|
-
"dev:contracts": "pnpm --filter 'contracts' dev",
|
|
9
|
-
"dev:node": "pnpm --filter 'contracts' devnode"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"run-pty": "^4.0.3"
|
|
13
|
-
},
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": "18.x",
|
|
16
|
-
"pnpm": "8.x"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "client",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"dev": "vite",
|
|
10
|
-
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@improbable-eng/grpc-web": "^0.15.0",
|
|
14
|
-
"@latticexyz/network": "{{mud-version}}",
|
|
15
|
-
"@latticexyz/react": "{{mud-version}}",
|
|
16
|
-
"@latticexyz/recs": "{{mud-version}}",
|
|
17
|
-
"@latticexyz/services": "{{mud-version}}",
|
|
18
|
-
"@latticexyz/std-client": "{{mud-version}}",
|
|
19
|
-
"@latticexyz/utils": "{{mud-version}}",
|
|
20
|
-
"async-mutex": "^0.4.0",
|
|
21
|
-
"contracts": "workspace:*",
|
|
22
|
-
"ethers": "^5.7.2",
|
|
23
|
-
"mobx": "^6.7.0",
|
|
24
|
-
"nice-grpc": "^2.0.1",
|
|
25
|
-
"nice-grpc-web": "^2.0.1",
|
|
26
|
-
"proxy-deep": "^3.1.1",
|
|
27
|
-
"react": "^18.2.0",
|
|
28
|
-
"threads": "^1.7.0"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
32
|
-
"@typescript-eslint/parser": "^5.46.1",
|
|
33
|
-
"eslint": "^8.29.0",
|
|
34
|
-
"typescript": "^4.9.5",
|
|
35
|
-
"vite": "^4.2.1"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -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
|
-
};
|