-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4d39db
commit 56cf0fc
Showing
1 changed file
with
26 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,44 @@ | ||
import { setup } from "./mud/setup"; | ||
import mudConfig from "contracts/mud.config"; | ||
import ReactDOM from "react-dom/client"; | ||
import { App } from './App'; | ||
import './common.scss'; | ||
import { world } from '@/mud/world'; | ||
import { App } from "./App"; | ||
import "./common.scss"; | ||
import { world } from "@/mud/world"; | ||
import { MUDProvider } from "@/mud/MUDContext"; | ||
const { | ||
network, | ||
} = await setup(); | ||
const { network } = await setup(); | ||
|
||
// Components expose a stream that triggers when the component is updated. | ||
|
||
|
||
const rootElement = document.getElementById("root"); | ||
setup().then(async (result) => { | ||
root.render( | ||
<MUDProvider value={result}> | ||
<App/> | ||
<App /> | ||
</MUDProvider> | ||
) | ||
); | ||
}); | ||
if (!rootElement) throw new Error("React root not found"); | ||
|
||
const root = ReactDOM.createRoot(rootElement); | ||
|
||
|
||
// https://vitejs.dev/guide/env-and-mode.html | ||
if (true) { | ||
const { mount: mountDevTools } = await import("@latticexyz/dev-tools"); | ||
const comp = []; | ||
network.world.components.forEach((c) => { | ||
if (comp.findIndex((item => item.id === c.id)) === -1) { | ||
comp.push(c); | ||
} | ||
}); | ||
network.world.components = comp; | ||
mountDevTools({ | ||
config: mudConfig, | ||
publicClient: network.publicClient, | ||
walletClient: network.walletClient, | ||
latestBlock$: network.latestBlock$, | ||
blockStorageOperations$: network.blockStorageOperations$, | ||
worldAddress: network.worldContract.address, | ||
worldAbi: network.worldContract.abi, | ||
write$: network.write$, | ||
recsWorld: network.world, | ||
}); | ||
console.log("mounted") | ||
} | ||
const { mount: mountDevTools } = await import("@latticexyz/dev-tools"); | ||
const comp = []; | ||
network.world.components.forEach((c) => { | ||
if (comp.findIndex((item) => item.id === c.id) === -1) { | ||
comp.push(c); | ||
} | ||
}); | ||
network.world.components = comp; | ||
mountDevTools({ | ||
config: mudConfig, | ||
publicClient: network.publicClient, | ||
walletClient: network.walletClient, | ||
latestBlock$: network.latestBlock$, | ||
blockStorageOperations$: network.blockStorageOperations$, | ||
worldAddress: network.worldContract.address, | ||
worldAbi: network.worldContract.abi, | ||
write$: network.write$, | ||
recsWorld: network.world, | ||
}); | ||
console.log("mounted"); |