create-mud 2.0.0-alpha.1.89 → 2.0.0-alpha.1.90
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/dist/cli.js +1 -1
- package/dist/templates/react/packages/client/src/mud/getNetworkConfig.ts +13 -14
- package/dist/templates/react/packages/contracts/.gitignore +1 -3
- package/dist/templates/react/packages/contracts/worlds.json +5 -0
- package/dist/templates/vanilla/packages/client/src/mud/getNetworkConfig.ts +13 -14
- package/dist/templates/vanilla/packages/contracts/.gitignore +1 -3
- package/dist/templates/vanilla/packages/contracts/worlds.json +5 -0
- package/package.json +2 -2
- package/dist/templates/react/packages/contracts/deploys/31337/latest.json +0 -4
- package/dist/templates/react/packages/contracts/deploys/4242/latest.json +0 -4
- package/dist/templates/vanilla/packages/contracts/deploys/31337/latest.json +0 -4
- package/dist/templates/vanilla/packages/contracts/deploys/4242/latest.json +0 -4
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var t=require("create-create-app"),a=require("path");var e={name:"create-mud",version:"2.0.0-alpha.1.
|
|
2
|
+
"use strict";var t=require("create-create-app"),a=require("path");var e={name:"create-mud",version:"2.0.0-alpha.1.90+9493f30c",description:"Create a new MUD project",license:"MIT",author:"Lattice <mud@lattice.xyz>",bin:"dist/cli.js",files:["dist"],scripts:{build:"pnpm run build:js","build:js":"tsup && ./scripts/copy-templates.sh",clean:"pnpm run clean:js","clean:js":"rimraf dist",dev:"tsup --watch",prepublishOnly:"npm run clean && npm run build",test:"pnpm run test:vanilla && pnpm run test:react","test:react":"dist/cli.js test-project --template react && rimraf test-project","test:vanilla":"dist/cli.js test-project --template vanilla && rimraf test-project"},dependencies:{"create-create-app":"git+https://github.com/holic/create-create-app#74376c59b48a04aabbe94d9cacfe9cb1cecccd63"},devDependencies:{"@types/node":"^18.15.11",tsup:"^6.7.0",typescript:"^4.9.5"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},gitHead:"9493f30c82b442fc0f3ca834543289be602a9c9f"};var c=(0,a.resolve)(__dirname,"..","dist","templates");(0,t.create)("create-mud",{templateRoot:c,defaultTemplate:"vanilla",defaultPackageManager:"pnpm",promptForDescription:!1,promptForAuthor:!1,promptForEmail:!1,promptForLicense:!1,promptForTemplate:!0,caveat:({answers:r,packageManager:s})=>`Done! Play in the MUD with \`cd ${r.name}\` and \`${s} run dev\``,extra:{"mud-version":{type:"input",describe:"The version of MUD packages to use, defaults to latest",default:e.version}}});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SetupContractConfig, getBurnerWallet } from "@latticexyz/std-client";
|
|
2
2
|
import { foundry } from "@wagmi/chains";
|
|
3
3
|
import latticeTestnet from "./supportedChains/latticeTestnet";
|
|
4
|
-
import latestLatticeTestnetDeploy from "contracts/deploys/4242/latest.json";
|
|
5
|
-
import latestLocalhostDeploy from "contracts/deploys/31337/latest.json";
|
|
6
4
|
import { MudChain } from "./supportedChains/types";
|
|
5
|
+
import worldsJson from "contracts/worlds.json";
|
|
6
|
+
|
|
7
|
+
const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;
|
|
7
8
|
|
|
8
9
|
type NetworkConfig = SetupContractConfig & {
|
|
9
10
|
privateKey: string;
|
|
@@ -14,25 +15,23 @@ export async function getNetworkConfig(): Promise<NetworkConfig> {
|
|
|
14
15
|
const params = new URLSearchParams(window.location.search);
|
|
15
16
|
|
|
16
17
|
const supportedChains: MudChain[] = [foundry, latticeTestnet];
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const chainId = Number(params.get("chainId") || import.meta.env.VITE_CHAIN_ID);
|
|
18
|
+
const chainId = Number(params.get("chainId") || import.meta.env.VITE_CHAIN_ID || 31337);
|
|
20
19
|
const chainIndex = supportedChains.findIndex((c) => c.id === chainId);
|
|
21
20
|
const chain = supportedChains[chainIndex];
|
|
22
21
|
if (!chain) {
|
|
23
22
|
throw new Error(`Chain ${chainId} not found`);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
throw new Error(`No deployment found for chain ${chainId}. Did you run \`mud deploy\`?`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const worldAddress = params.get("worldAddress") || deploy.worldAddress;
|
|
25
|
+
const world = worlds[chain.id.toString()];
|
|
26
|
+
const worldAddress = params.get("worldAddress") || world?.address;
|
|
32
27
|
if (!worldAddress) {
|
|
33
|
-
throw new Error(
|
|
28
|
+
throw new Error(`No world address found for chain ${chainId}. Did you run \`mud deploy\`?`);
|
|
34
29
|
}
|
|
35
30
|
|
|
31
|
+
const initialBlockNumber = params.has("initialBlockNumber")
|
|
32
|
+
? Number(params.get("initialBlockNumber"))
|
|
33
|
+
: world?.blockNumber ?? -1; // -1 will attempt to find the block number from RPC
|
|
34
|
+
|
|
36
35
|
return {
|
|
37
36
|
clock: {
|
|
38
37
|
period: 1000,
|
|
@@ -49,7 +48,7 @@ export async function getNetworkConfig(): Promise<NetworkConfig> {
|
|
|
49
48
|
modeUrl: params.get("mode") ?? chain.modeUrl,
|
|
50
49
|
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
|
|
51
50
|
worldAddress,
|
|
52
|
-
initialBlockNumber
|
|
53
|
-
|
|
51
|
+
initialBlockNumber,
|
|
52
|
+
disableCache: params.get("cache") === "false",
|
|
54
53
|
};
|
|
55
54
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SetupContractConfig, getBurnerWallet } from "@latticexyz/std-client";
|
|
2
2
|
import { foundry } from "@wagmi/chains";
|
|
3
3
|
import latticeTestnet from "./supportedChains/latticeTestnet";
|
|
4
|
-
import latestLatticeTestnetDeploy from "contracts/deploys/4242/latest.json";
|
|
5
|
-
import latestLocalhostDeploy from "contracts/deploys/31337/latest.json";
|
|
6
4
|
import { MudChain } from "./supportedChains/types";
|
|
5
|
+
import worldsJson from "contracts/worlds.json";
|
|
6
|
+
|
|
7
|
+
const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;
|
|
7
8
|
|
|
8
9
|
type NetworkConfig = SetupContractConfig & {
|
|
9
10
|
privateKey: string;
|
|
@@ -14,25 +15,23 @@ export async function getNetworkConfig(): Promise<NetworkConfig> {
|
|
|
14
15
|
const params = new URLSearchParams(window.location.search);
|
|
15
16
|
|
|
16
17
|
const supportedChains: MudChain[] = [foundry, latticeTestnet];
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const chainId = Number(params.get("chainId") || import.meta.env.VITE_CHAIN_ID);
|
|
18
|
+
const chainId = Number(params.get("chainId") || import.meta.env.VITE_CHAIN_ID || 31337);
|
|
20
19
|
const chainIndex = supportedChains.findIndex((c) => c.id === chainId);
|
|
21
20
|
const chain = supportedChains[chainIndex];
|
|
22
21
|
if (!chain) {
|
|
23
22
|
throw new Error(`Chain ${chainId} not found`);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
throw new Error(`No deployment found for chain ${chainId}. Did you run \`mud deploy\`?`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const worldAddress = params.get("worldAddress") || deploy.worldAddress;
|
|
25
|
+
const world = worlds[chain.id.toString()];
|
|
26
|
+
const worldAddress = params.get("worldAddress") || world?.address;
|
|
32
27
|
if (!worldAddress) {
|
|
33
|
-
throw new Error(
|
|
28
|
+
throw new Error(`No world address found for chain ${chainId}. Did you run \`mud deploy\`?`);
|
|
34
29
|
}
|
|
35
30
|
|
|
31
|
+
const initialBlockNumber = params.has("initialBlockNumber")
|
|
32
|
+
? Number(params.get("initialBlockNumber"))
|
|
33
|
+
: world?.blockNumber ?? -1; // -1 will attempt to find the block number from RPC
|
|
34
|
+
|
|
36
35
|
return {
|
|
37
36
|
clock: {
|
|
38
37
|
period: 1000,
|
|
@@ -49,7 +48,7 @@ export async function getNetworkConfig(): Promise<NetworkConfig> {
|
|
|
49
48
|
modeUrl: params.get("mode") ?? chain.modeUrl,
|
|
50
49
|
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
|
|
51
50
|
worldAddress,
|
|
52
|
-
initialBlockNumber
|
|
53
|
-
|
|
51
|
+
initialBlockNumber,
|
|
52
|
+
disableCache: params.get("cache") === "false",
|
|
54
53
|
};
|
|
55
54
|
}
|
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.90+9493f30c",
|
|
4
4
|
"description": "Create a new MUD project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lattice <mud@lattice.xyz>",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"access": "public",
|
|
32
32
|
"registry": "https://registry.npmjs.org"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "9493f30c82b442fc0f3ca834543289be602a9c9f"
|
|
35
35
|
}
|