Skip to content

Commit

Permalink
Fix DojoProvider usage in react examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Satyam Bansal committed Jan 14, 2024
1 parent f6c4540 commit 72c2ce9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions examples/react/react-app/dojoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
VITE_PUBLIC_MASTER_ADDRESS,
VITE_PUBLIC_MASTER_PRIVATE_KEY,
VITE_PUBLIC_ACCOUNT_CLASS_HASH,
VITE_PUBLIC_WORLD_ADDRESS,
} = import.meta.env;

export type Config = ReturnType<typeof dojoConfig>;
Expand All @@ -23,6 +24,10 @@ export function dojoConfig() {
accountClassHash:
VITE_PUBLIC_ACCOUNT_CLASS_HASH ||
"0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e",
worldAddress:
VITE_PUBLIC_WORLD_ADDRESS ||
manifest.world.address ||
"0x28f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a",
manifest,
};
}
6 changes: 5 additions & 1 deletion examples/react/react-app/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export async function setup({ ...config }: Config) {
await getSyncEntities(toriiClient, contractComponents as any);

const client = await setupWorld(
new DojoProvider(config.manifest, config.rpcUrl)
new DojoProvider(
config.worldAddress,
config.manifest,
config.rpcUrl
)
);

return {
Expand Down
5 changes: 5 additions & 0 deletions examples/react/react-phaser-example/dojoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
VITE_PUBLIC_MASTER_ADDRESS,
VITE_PUBLIC_MASTER_PRIVATE_KEY,
VITE_PUBLIC_ACCOUNT_CLASS_HASH,
VITE_PUBLIC_WORLD_ADDRESS,
} = import.meta.env;

export type Config = ReturnType<typeof dojoConfig>;
Expand All @@ -23,6 +24,10 @@ export function dojoConfig() {
accountClassHash:
VITE_PUBLIC_ACCOUNT_CLASS_HASH ||
"0x33ac2f528bb97cc7b79148fd1756dc368be0e95d391d8c6d6473ecb60b4560e",
worldAddress:
VITE_PUBLIC_WORLD_ADDRESS ||
manifest.world.address ||
"0x28f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a",
manifest,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function setup({ ...config }: Config) {
await getSyncEntities(toriiClient, contractComponents as any);

const client = await setupWorld(
new DojoProvider(config.manifest, config.rpcUrl)
new DojoProvider(config.worldAddress, config.manifest, config.rpcUrl)
);

return {
Expand Down

0 comments on commit 72c2ce9

Please sign in to comment.