Skip to content

Commit

Permalink
feat(create-mud): add worlds.json types (#1430)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Sep 11, 2023
1 parent b519d96 commit d3049a2
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 25 deletions.
4 changes: 1 addition & 3 deletions e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 2 additions & 0 deletions e2e/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/packages/contracts/worlds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"blockNumber": 21817970
},
"31337": {
"address": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E"
"address": "0x5FbDB2315678afecb367f032d93F642f64180aa3"
}
}
2 changes: 2 additions & 0 deletions examples/minimal/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;
4 changes: 1 addition & 3 deletions templates/phaser/packages/client/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 2 additions & 0 deletions templates/phaser/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;
4 changes: 1 addition & 3 deletions templates/react/packages/client/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 2 additions & 0 deletions templates/react/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 2 additions & 0 deletions templates/threejs/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getBurnerPrivateKey } from "@latticexyz/common";
import worldsJson from "contracts/worlds.json";
import worlds from "contracts/worlds.json";
import { supportedChains } from "./supportedChains";

const worlds = worldsJson as Partial<Record<string, { address: string; blockNumber?: number }>>;

export async function getNetworkConfig() {
const params = new URLSearchParams(window.location.search);
const chainId = Number(params.get("chainId") || params.get("chainid") || import.meta.env.VITE_CHAIN_ID || 31337);
Expand Down
2 changes: 2 additions & 0 deletions templates/vanilla/packages/contracts/worlds.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const worlds: Partial<Record<string, { address: string; blockNumber?: number }>>;
export default worlds;

0 comments on commit d3049a2

Please sign in to comment.