Skip to content

Commit

Permalink
feat(templates/react-ecs): use a namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
qbzzt committed May 13, 2024
1 parent b91a8e5 commit 3833cac
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function createSystemCalls(
* is in the root namespace, `.increment` can be called directly
* on the World contract.
*/
const tx = await worldContract.write.increment();
const tx = await worldContract.write.counter__increment();
await waitForTransaction(tx);
return getComponentValue(Counter, singletonEntity);
};
Expand Down
1 change: 1 addition & 0 deletions templates/react-ecs/packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineWorld } from "@latticexyz/world";

export default defineWorld({
namespace: "counter",
tables: {
Counter: {
schema: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract PostDeploy is Script {
// ------------------ EXAMPLES ------------------

// Call increment on the world via the registered function selector
uint32 newValue = IWorld(worldAddress).increment();
uint32 newValue = IWorld(worldAddress).counter__increment();
console.log("Increment via IWorld:", newValue);

vm.stopBroadcast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract CounterTest is MudTest {
assertEq(counter, 1);

// Expect the counter to be 2 after calling increment.
IWorld(worldAddress).increment();
IWorld(worldAddress).counter__increment();
counter = Counter.get();
assertEq(counter, 2);
}
Expand Down

0 comments on commit 3833cac

Please sign in to comment.