Skip to content

Commit c1dc5b6

Browse files
fix: prettier
1 parent 105af37 commit c1dc5b6

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

examples/example-vite-react-sdk/src/App.tsx

+8-35
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
import { useEffect, useState } from "react";
2-
32
import "./App.css";
3+
import { ParsedEntity, SDK } from "@dojoengine/sdk";
4+
import { Schema } from "./bindings.ts";
45

5-
import { init, ParsedEntity } from "@dojoengine/sdk";
6-
7-
import { dojoConfig } from "../dojoConfig.ts";
8-
import { Schema, schema } from "./bindings.ts";
9-
10-
const db = await init<Schema>(
11-
{
12-
client: {
13-
rpcUrl: dojoConfig.rpcUrl,
14-
toriiUrl: dojoConfig.toriiUrl,
15-
relayUrl: dojoConfig.relayUrl,
16-
worldAddress:
17-
"0x5d475a9221f6cbf1a016b12400a01b9a89935069aecd57e9876fcb2a7bb29da",
18-
},
19-
domain: {
20-
name: "Example",
21-
version: "1.0",
22-
chainId: "your-chain-id",
23-
revision: "1",
24-
},
25-
},
26-
schema
27-
);
28-
29-
function App() {
6+
function App({ db }: { db: SDK<Schema> }) {
307
const [entities, setEntities] = useState<ParsedEntity<Schema>[]>([]);
318

329
useEffect(() => {
@@ -37,13 +14,7 @@ function App() {
3714
{
3815
dojo_starter: {
3916
Moves: {
40-
$: {
41-
where: {
42-
player: {
43-
$is: "0x3628a39cc6bd2347e79967e9458ac41ab65bac6949f2aa311b311aff0d7334d",
44-
},
45-
},
46-
},
17+
$: {},
4718
},
4819
},
4920
},
@@ -81,7 +52,9 @@ function App() {
8152
unsubscribe();
8253
}
8354
};
84-
}, []);
55+
}, [db]);
56+
57+
console.log("entities:");
8558

8659
useEffect(() => {
8760
const fetchEntities = async () => {
@@ -129,7 +102,7 @@ function App() {
129102
};
130103

131104
fetchEntities();
132-
}, []);
105+
}, [db]);
133106

134107
return (
135108
<div>

examples/example-vite-react-sdk/src/main.tsx

+32-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,36 @@ import { createRoot } from "react-dom/client";
44
import App from "./App.tsx";
55

66
import "./index.css";
7+
import { init } from "@dojoengine/sdk";
8+
import { Schema, schema } from "./bindings.ts";
9+
import { dojoConfig } from "../dojoConfig.ts";
710

8-
createRoot(document.getElementById("root")!).render(
9-
<StrictMode>
10-
<App />
11-
</StrictMode>
12-
);
11+
async function main() {
12+
const db = await init<Schema>(
13+
{
14+
client: {
15+
rpcUrl: dojoConfig.rpcUrl,
16+
toriiUrl: dojoConfig.toriiUrl,
17+
relayUrl: dojoConfig.relayUrl,
18+
worldAddress: dojoConfig.manifest.world.address,
19+
},
20+
domain: {
21+
name: "Example",
22+
version: "1.0",
23+
chainId: "your-chain-id",
24+
revision: "1",
25+
},
26+
},
27+
schema
28+
);
29+
30+
createRoot(document.getElementById("root")!).render(
31+
<StrictMode>
32+
<App db={db} />
33+
</StrictMode>
34+
);
35+
}
36+
37+
main().catch((error) => {
38+
console.error("Failed to initialize the application:", error);
39+
});

0 commit comments

Comments
 (0)