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 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.89+2d9bacf4",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:"2d9bacf467d948a8dde5b76fff248af3c711db2b"};var i=(0,a.resolve)(__dirname,"..","dist","templates");(0,t.create)("create-mud",{templateRoot:i,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}}});
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 deploys = [latestLocalhostDeploy, latestLatticeTestnetDeploy];
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 deploy = deploys[chainIndex];
27
- if (!deploy) {
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("No world address provided");
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: Number(params.get("initialBlockNumber")) || deploy.blockNumber || 0,
53
- devMode: params.get("dev") === "true",
51
+ initialBlockNumber,
52
+ disableCache: params.get("cache") === "false",
54
53
  };
55
54
  }
@@ -7,7 +7,5 @@ abi/
7
7
  types/
8
8
  broadcast/
9
9
 
10
- # Ignore all deploy artifacts
10
+ # Ignore MUD deploy artifacts
11
11
  deploys/**/*.json
12
- # Except the latest ones (so we can load these into client)
13
- !deploys/**/latest.json
@@ -0,0 +1,5 @@
1
+ {
2
+ "31337": {
3
+ "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
4
+ }
5
+ }
@@ -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 deploys = [latestLocalhostDeploy, latestLatticeTestnetDeploy];
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 deploy = deploys[chainIndex];
27
- if (!deploy) {
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("No world address provided");
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: Number(params.get("initialBlockNumber")) || deploy.blockNumber || 0,
53
- devMode: params.get("dev") === "true",
51
+ initialBlockNumber,
52
+ disableCache: params.get("cache") === "false",
54
53
  };
55
54
  }
@@ -7,7 +7,5 @@ abi/
7
7
  types/
8
8
  broadcast/
9
9
 
10
- # Ignore all deploy artifacts
10
+ # Ignore MUD deploy artifacts
11
11
  deploys/**/*.json
12
- # Except the latest ones (so we can load these into client)
13
- !deploys/**/latest.json
@@ -0,0 +1,5 @@
1
+ {
2
+ "31337": {
3
+ "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mud",
3
- "version": "2.0.0-alpha.1.89+2d9bacf4",
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": "2d9bacf467d948a8dde5b76fff248af3c711db2b"
34
+ "gitHead": "9493f30c82b442fc0f3ca834543289be602a9c9f"
35
35
  }
@@ -1,4 +0,0 @@
1
- {
2
- "worldAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
3
- "blockNumber": 9
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "worldAddress": "0xf0F5e9b00b92f3999021fD8B88aC75c351D93fc7",
3
- "blockNumber": 10591501
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "worldAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
3
- "blockNumber": 9
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "worldAddress": "0xf0F5e9b00b92f3999021fD8B88aC75c351D93fc7",
3
- "blockNumber": 10591501
4
- }