diff --git a/docs/pages/guides/extending-world.mdx b/docs/pages/guides/extending-world.mdx index 31748bda84..ffd7490a28 100644 --- a/docs/pages/guides/extending-world.mdx +++ b/docs/pages/guides/extending-world.mdx @@ -375,7 +375,7 @@ The easiest way to create the Solidity code is to use the MUD template: Register `MessageSystem.incrementMessage(string)`. This step is necessary to make the function accessible through the `World`. - The function's name when accessed through the world is `__`, so this function will be available as `messaging_message_incrementMessage(string)`. + The function's name when accessed through the world is `__`, so this function will be available as `messaging__incrementMessage(string)`. **Note:** This is the case for all namespaces except for the root namespace, where we just use the name of the function (such as `increment()`). @@ -401,10 +401,10 @@ The easiest way to create the Solidity code is to use the MUD template: ```sh copy source .env - cast send $WORLD_ADDRESS --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY "messaging_MessageSystem_incrementMessage(string)" "hello" + cast send $WORLD_ADDRESS --rpc-url http://localhost:8545 --private-key $PRIVATE_KEY "messaging__incrementMessage(string)" "hello" ``` - When a function is _not_ in the root namespace, it is accessible as `__` (as long as it is [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L164-L201)). + When a function is _not_ in the root namespace, it is accessible as `__` (as long as it is [registered](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L164-L201)). Here we call our `incrementMessage(string)` with the parameter `hello`. @@ -561,7 +561,7 @@ We will fix these problems now. ### Increment and send a message -Edit `src/mud/createSystemCalls.ts` to use the new `messaging_MessageSystem_incrementMessage` function instead of `increment`. +Edit `src/mud/createSystemCalls.ts` to use the new `messaging__incrementMessage` function instead of `increment`. @@ -608,7 +608,7 @@ Edit `src/mud/createSystemCalls.ts` to use the new `messaging_MessageSystem_incr * is in the root namespace, `.increment` can be called directly * on the World contract. */ - const tx = await worldContract.write.messaging_MessageSystem_incrementMessage( + const tx = await worldContract.write.messaging__incrementMessage( [`message at ${Date()}`]); await waitForTransaction(tx); return getComponentValue(Counter, singletonEntity); diff --git a/docs/pages/world/function-selectors.mdx b/docs/pages/world/function-selectors.mdx index e89e94cd53..8adb954fa5 100644 --- a/docs/pages/world/function-selectors.mdx +++ b/docs/pages/world/function-selectors.mdx @@ -12,7 +12,7 @@ If [you have the necessary delegation](/world/account-delegation) you can also u To improve the developer experience of calling `System` functions, the namespace owner can register a function selector for each `System` function in the `World` contract. This removes the need for the caller to know the system's `ResourceId`, and the need to manually encode the calldata via `abi.encodeCall`. -Once the namespace owner registers a function selector for a `System` function, anybody can call the `System` via `.__()`. +Once the namespace owner registers a function selector for a `System` function, anybody can call the `System` via `.__()`. To register a function selector, you use [`.registerFunctionSelector`](https://github.com/latticexyz/mud/blob/main/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol#L164-L201). This function takes two parameters: @@ -34,7 +34,7 @@ This is the code we use to register the `System` and the function selector: After the function selector is registered, it can be accessed directly on the World: ```solidity - world.messaging_message_incrementMessage("hello"); + world.messaging__incrementMessage("hello"); ``` ## Root function selectors diff --git a/docs/pages/world/systems.mdx b/docs/pages/world/systems.mdx index 209ec0af64..81e7505c0a 100644 --- a/docs/pages/world/systems.mdx +++ b/docs/pages/world/systems.mdx @@ -20,7 +20,7 @@ The `World` serves as a central entry point and forwards calls to systems, which To call a `System`, you call the `World` in one of these ways: -- If a [function selector for the `System` is registered in the `World`](./function-selectors), you can call it via `world.__()`. +- If a [function selector for the `System` is registered in the `World`](./function-selectors), you can call it via `world.__()`. - You can use [`call`](https://github.com/latticexyz/mud/blob/main/packages/world/src/World.sol#L346-L351). - If you have [the proper delegation](/world/account-delegation) you can use [`callFrom`](https://github.com/latticexyz/mud/blob/main/packages/world/src/World.sol#L353-L394). diff --git a/docs/pages/world/world-table-illustration.mdx b/docs/pages/world/world-table-illustration.mdx index 7ad9dd8186..08fffcc5e1 100644 --- a/docs/pages/world/world-table-illustration.mdx +++ b/docs/pages/world/world-table-illustration.mdx @@ -1,7 +1,7 @@ ![Interaction between the `World`, a `System`, and a table](./world-table.svg) -1. An account calls a function called `namespace_system_function` via the `World`. - [This function was registered](./function-selectors) by the owner of the `namespace` namespace and points to the `function` function in the `system` system in the `namespace` namespace. +1. An account calls a function called `namespace__function` via the `World`. + [This function was registered](./function-selectors) by the owner of the `namespace` namespace and points to the `function` function in one of the `System`s in the `namespace` namespace. 2. The `World` verifies that access is permitted (for example, because `namespace:system` is publicly accessible) and if so calls `function` on the `namespace:system` contract with the provided parameters. diff --git a/docs/pages/world/world-table.svg b/docs/pages/world/world-table.svg index af46a1f522..a2ae678bc5 100644 --- a/docs/pages/world/world-table.svg +++ b/docs/pages/world/world-table.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file