diff --git a/.changeset/pre.json b/.changeset/pre.json index 4a736359d97..470be47d985 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -43,6 +43,7 @@ "brave-needles-love", "brave-rings-tickle", "breezy-cameras-switch", + "breezy-seahorses-prove", "bright-flies-hug", "brown-garlics-lie", "brown-icons-burn", @@ -67,6 +68,9 @@ "eighty-pots-report", "eighty-tigers-argue", "empty-planes-kiss", + "empty-starfishes-lick", + "fair-buckets-dress", + "famous-carrots-marry", "fast-ears-hug", "fast-zebras-drum", "fast-zebras-promise", @@ -75,6 +79,7 @@ "few-mirrors-reflect", "few-papayas-leave", "fifty-squids-eat", + "fifty-suits-itch", "fifty-suits-shout", "flat-trainers-marry", "fluffy-moles-march", @@ -84,9 +89,11 @@ "fuzzy-cars-stare", "giant-masks-carry", "gold-rings-switch", + "gorgeous-swans-hide", "great-cooks-dream", "grumpy-files-heal", "grumpy-geckos-raise", + "happy-pants-try", "heavy-eyes-smile", "hip-tables-check", "honest-months-boil", @@ -168,21 +175,25 @@ "serious-plants-itch", "seven-flies-chew", "seven-mangos-roll", + "sharp-falcons-tie", "sharp-worms-kneel", "short-ads-jog", "short-dragons-shout", "shy-monkeys-wonder", "shy-sheep-wait", + "silent-buttons-peel", "silent-carrots-glow", "silent-rice-argue", "silly-snakes-fold", "silver-dolls-shave", "silver-mangos-thank", + "silver-nails-explain", "six-cats-agree", "six-kangaroos-sneeze", "slimy-glasses-tickle", "small-boxes-rush", "small-chicken-repair", + "small-dots-poke", "small-pots-press", "smooth-elephants-wave", "smooth-pots-nail", @@ -210,6 +221,7 @@ "thin-terms-lay", "thirty-cups-provide", "three-lizards-shave", + "three-scissors-smile", "tough-flowers-breathe", "tricky-beds-kiss", "tricky-carrots-talk", diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d6b560119..1f15412be79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,192 @@ +## Version 2.0.0-next.13 + +Release date: Thu Nov 02 2023 + +### Major changes + +**[feat(utils): remove hash utils and ethers (#1783)](https://github.com/latticexyz/mud/commit/52182f70d350bb99cdfa6054cd6d181e58a91aa6)** (@latticexyz/utils) + +Removed `keccak256` and `keccak256Coord` hash utils in favor of [viem's `keccak256`](https://viem.sh/docs/utilities/keccak256.html#keccak256). + +```diff +- import { keccak256 } from "@latticexyz/utils"; ++ import { keccak256, toHex } from "viem"; + +- const hash = keccak256("some string"); ++ const hash = keccak256(toHex("some string")); +``` + +```diff +- import { keccak256Coord } from "@latticexyz/utils"; ++ import { encodeAbiParameters, keccak256, parseAbiParameters } from "viem"; + + const coord = { x: 1, y: 1 }; +- const hash = keccak256Coord(coord); ++ const hash = keccak256(encodeAbiParameters(parseAbiParameters("int32, int32"), [coord.x, coord.y])); +``` + +**[feat(store-indexer,store-sync): filter by table and key (#1794)](https://github.com/latticexyz/mud/commit/f6d214e3d79f9591fddd3687aa987a57f417256c)** (@latticexyz/store-indexer) + +Removed `tableIds` filter option in favor of the more flexible `filters` option that accepts `tableId` and an optional `key0` and/or `key1` to filter data by tables and keys. + +If you were using an indexer client directly, you'll need to update your query: + +```diff + await indexer.findAll.query({ + chainId, + address, +- tableIds: ['0x...'], ++ filters: [{ tableId: '0x...' }], + }); +``` + +**[feat(create-mud): move react template to zustand, add react-ecs template (#1851)](https://github.com/latticexyz/mud/commit/78949f2c939ff5f743c026367c5978cb459f6f88)** (create-mud) + +Replaced the `react` template with a basic task list app using the new Zustand storage adapter and sync method. This new template better demonstrates the different ways of building with MUD and has fewer concepts to learn (i.e. just tables and records, no more ECS). + +For ECS-based React apps, you can use `react-ecs` template for the previous RECS storage adapter. + +### Minor changes + +**[feat(store-sync): extra table definitions (#1840)](https://github.com/latticexyz/mud/commit/de47d698f031a28ef8d9e329e3cffc85e904c6a1)** (@latticexyz/store-sync) + +Added an optional `tables` option to `syncToRecs` to allow you to sync from tables that may not be expressed by your MUD config. This will be useful for namespaced tables used by [ERC20](https://github.com/latticexyz/mud/pull/1789) and [ERC721](https://github.com/latticexyz/mud/pull/1844) token modules until the MUD config gains [namespace support](https://github.com/latticexyz/mud/issues/994). + +Here's how we use this in our example project with the `KeysWithValue` module: + +```ts +syncToRecs({ + ... + tables: { + KeysWithValue: { + namespace: "keywval", + name: "Inventory", + tableId: resourceToHex({ type: "table", namespace: "keywval", name: "Inventory" }), + keySchema: { + valueHash: { type: "bytes32" }, + }, + valueSchema: { + keysWithValue: { type: "bytes32[]" }, + }, + }, + }, + ... +}); +``` + +**[feat(world-modules): add ERC721 module (#1844)](https://github.com/latticexyz/mud/commit/d7325e517ce18597d55e8bce41036e78e00c3a78)** (@latticexyz/world-modules) + +Added the `ERC721Module` to `@latticexyz/world-modules`. +This module allows the registration of `ERC721` tokens in an existing World. + +Important note: this module has not been audited yet, so any production use is discouraged for now. + +````solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { ERC721MetadataData } from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/ERC721Metadata.sol"; +import { IERC721Mintable } from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; +import { registerERC721 } from "@latticexyz/world-modules/src/modules/erc721-puppet/registerERC721.sol"; + +// The ERC721 module requires the Puppet module to be installed first +world.installModule(new PuppetModule(), new bytes(0)); + +// After the Puppet module is installed, new ERC721 tokens can be registered +IERC721Mintable token = registerERC721(world, "myERC721", ERC721MetadataData({ name: "Token", symbol: "TKN", baseURI: "" }));``` +```` + +**[feat(world-modules): add puppet module (#1793)](https://github.com/latticexyz/mud/commit/35348f831b923aed6e9bdf8b38bf337f3e944a48)** (@latticexyz/world-modules) + +Added the `PuppetModule` to `@latticexyz/world-modules`. The puppet pattern allows an external contract to be registered as an external interface for a MUD system. +This allows standards like `ERC20` (that require a specific interface and events to be emitted by a unique contract) to be implemented inside a MUD World. + +The puppet serves as a proxy, forwarding all calls to the implementation system (also called the "puppet master"). +The "puppet master" system can emit events from the puppet contract. + +```solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { createPuppet } from "@latticexyz/world-modules/src/modules/puppet/createPuppet.sol"; + +// Install the puppet module +world.installModule(new PuppetModule(), new bytes(0)); + +// Register a new puppet for any system +// The system must implement the `CustomInterface`, +// and the caller must own the system's namespace +CustomInterface puppet = CustomInterface(createPuppet(world, )); +``` + +**[feat(store-indexer,store-sync): filter by table and key (#1794)](https://github.com/latticexyz/mud/commit/f6d214e3d79f9591fddd3687aa987a57f417256c)** (@latticexyz/store-sync) + +Added a `filters` option to store sync to allow filtering client data on tables and keys. Previously, it was only possible to filter on `tableIds`, but the new filter option allows for more flexible filtering by key. + +If you are building a large MUD application, you can use positional keys as a way to shard data and make it possible to load only the data needed in the client for a particular section of your app. We're using this already in Sky Strife to load match-specific data into match pages without having to load data for all matches, greatly improving load time and client performance. + +```ts +syncToRecs({ + ... + filters: [{ tableId: '0x...', key0: '0x...' }], +}); +``` + +The `tableIds` option is now deprecated and will be removed in the future, but is kept here for backwards compatibility. + +**[feat(world-modules): add ERC20 module (#1789)](https://github.com/latticexyz/mud/commit/83638373450af5d8f703a183a74107ef7efb4152)** (@latticexyz/world-modules) + +Added the `ERC20Module` to `@latticexyz/world-modules`. +This module allows the registration of `ERC20` tokens in an existing World. + +Important note: this module has not been audited yet, so any production use is discouraged for now. + +```solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { IERC20Mintable } from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; +import { registerERC20 } from "@latticexyz/world-modules/src/modules/erc20-puppet/registerERC20.sol"; + +// The ERC20 module requires the Puppet module to be installed first +world.installModule(new PuppetModule(), new bytes(0)); + +// After the Puppet module is installed, new ERC20 tokens can be registered +IERC20Mintable token = registerERC20(world, "myERC20", ERC20MetadataData({ decimals: 18, name: "Token", symbol: "TKN" })); +``` + +**[feat(store-sync): sync to zustand (#1843)](https://github.com/latticexyz/mud/commit/fa77635839e760a9de5fc8959ee492b7a4d8a7cd)** (@latticexyz/store-sync) + +Added a Zustand storage adapter and corresponding `syncToZustand` method for use in vanilla and React apps. It's used much like the other sync methods, except it returns a bound store and set of typed tables. + +```ts +import { syncToZustand } from "@latticexyz/store-sync/zustand"; +import config from "contracts/mud.config"; + +const { tables, useStore, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToZustand({ + config, + ... +}); + +// in vanilla apps +const positions = useStore.getState().getRecords(tables.Position); + +// in React apps +const positions = useStore((state) => state.getRecords(tables.Position)); +``` + +This change will be shortly followed by an update to our templates that uses Zustand as the default client data store and sync method. + +**[feat(store): add experimental config resolve helper (#1826)](https://github.com/latticexyz/mud/commit/b1d41727d4b1964ad3cd907c1c2126b02172b413)** (@latticexyz/common) + +Added a `mapObject` helper to map the value of each property of an object to a new value. + +### Patch changes + +**[fix(create-mud): set store address in PostDeploy script (#1817)](https://github.com/latticexyz/mud/commit/c5148da763645e0adc1250245ea447904014bef2)** (create-mud) + +Updated templates' PostDeploy script to set store address so that tables can be used directly inside PostDeploy. + +**[fix(common,config): remove chalk usage (#1824)](https://github.com/latticexyz/mud/commit/3e057061da17dd2d0c5fd23e6f5a027bdf9a9223)** (@latticexyz/common, @latticexyz/config) + +Removed chalk usage from modules imported in client fix downstream client builds (vite in particular). + +--- + ## Version 2.0.0-next.12 Release date: Fri Oct 20 2023 diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 55d6b560119..1f15412be79 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -1,3 +1,192 @@ +## Version 2.0.0-next.13 + +Release date: Thu Nov 02 2023 + +### Major changes + +**[feat(utils): remove hash utils and ethers (#1783)](https://github.com/latticexyz/mud/commit/52182f70d350bb99cdfa6054cd6d181e58a91aa6)** (@latticexyz/utils) + +Removed `keccak256` and `keccak256Coord` hash utils in favor of [viem's `keccak256`](https://viem.sh/docs/utilities/keccak256.html#keccak256). + +```diff +- import { keccak256 } from "@latticexyz/utils"; ++ import { keccak256, toHex } from "viem"; + +- const hash = keccak256("some string"); ++ const hash = keccak256(toHex("some string")); +``` + +```diff +- import { keccak256Coord } from "@latticexyz/utils"; ++ import { encodeAbiParameters, keccak256, parseAbiParameters } from "viem"; + + const coord = { x: 1, y: 1 }; +- const hash = keccak256Coord(coord); ++ const hash = keccak256(encodeAbiParameters(parseAbiParameters("int32, int32"), [coord.x, coord.y])); +``` + +**[feat(store-indexer,store-sync): filter by table and key (#1794)](https://github.com/latticexyz/mud/commit/f6d214e3d79f9591fddd3687aa987a57f417256c)** (@latticexyz/store-indexer) + +Removed `tableIds` filter option in favor of the more flexible `filters` option that accepts `tableId` and an optional `key0` and/or `key1` to filter data by tables and keys. + +If you were using an indexer client directly, you'll need to update your query: + +```diff + await indexer.findAll.query({ + chainId, + address, +- tableIds: ['0x...'], ++ filters: [{ tableId: '0x...' }], + }); +``` + +**[feat(create-mud): move react template to zustand, add react-ecs template (#1851)](https://github.com/latticexyz/mud/commit/78949f2c939ff5f743c026367c5978cb459f6f88)** (create-mud) + +Replaced the `react` template with a basic task list app using the new Zustand storage adapter and sync method. This new template better demonstrates the different ways of building with MUD and has fewer concepts to learn (i.e. just tables and records, no more ECS). + +For ECS-based React apps, you can use `react-ecs` template for the previous RECS storage adapter. + +### Minor changes + +**[feat(store-sync): extra table definitions (#1840)](https://github.com/latticexyz/mud/commit/de47d698f031a28ef8d9e329e3cffc85e904c6a1)** (@latticexyz/store-sync) + +Added an optional `tables` option to `syncToRecs` to allow you to sync from tables that may not be expressed by your MUD config. This will be useful for namespaced tables used by [ERC20](https://github.com/latticexyz/mud/pull/1789) and [ERC721](https://github.com/latticexyz/mud/pull/1844) token modules until the MUD config gains [namespace support](https://github.com/latticexyz/mud/issues/994). + +Here's how we use this in our example project with the `KeysWithValue` module: + +```ts +syncToRecs({ + ... + tables: { + KeysWithValue: { + namespace: "keywval", + name: "Inventory", + tableId: resourceToHex({ type: "table", namespace: "keywval", name: "Inventory" }), + keySchema: { + valueHash: { type: "bytes32" }, + }, + valueSchema: { + keysWithValue: { type: "bytes32[]" }, + }, + }, + }, + ... +}); +``` + +**[feat(world-modules): add ERC721 module (#1844)](https://github.com/latticexyz/mud/commit/d7325e517ce18597d55e8bce41036e78e00c3a78)** (@latticexyz/world-modules) + +Added the `ERC721Module` to `@latticexyz/world-modules`. +This module allows the registration of `ERC721` tokens in an existing World. + +Important note: this module has not been audited yet, so any production use is discouraged for now. + +````solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { ERC721MetadataData } from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/ERC721Metadata.sol"; +import { IERC721Mintable } from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; +import { registerERC721 } from "@latticexyz/world-modules/src/modules/erc721-puppet/registerERC721.sol"; + +// The ERC721 module requires the Puppet module to be installed first +world.installModule(new PuppetModule(), new bytes(0)); + +// After the Puppet module is installed, new ERC721 tokens can be registered +IERC721Mintable token = registerERC721(world, "myERC721", ERC721MetadataData({ name: "Token", symbol: "TKN", baseURI: "" }));``` +```` + +**[feat(world-modules): add puppet module (#1793)](https://github.com/latticexyz/mud/commit/35348f831b923aed6e9bdf8b38bf337f3e944a48)** (@latticexyz/world-modules) + +Added the `PuppetModule` to `@latticexyz/world-modules`. The puppet pattern allows an external contract to be registered as an external interface for a MUD system. +This allows standards like `ERC20` (that require a specific interface and events to be emitted by a unique contract) to be implemented inside a MUD World. + +The puppet serves as a proxy, forwarding all calls to the implementation system (also called the "puppet master"). +The "puppet master" system can emit events from the puppet contract. + +```solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { createPuppet } from "@latticexyz/world-modules/src/modules/puppet/createPuppet.sol"; + +// Install the puppet module +world.installModule(new PuppetModule(), new bytes(0)); + +// Register a new puppet for any system +// The system must implement the `CustomInterface`, +// and the caller must own the system's namespace +CustomInterface puppet = CustomInterface(createPuppet(world, )); +``` + +**[feat(store-indexer,store-sync): filter by table and key (#1794)](https://github.com/latticexyz/mud/commit/f6d214e3d79f9591fddd3687aa987a57f417256c)** (@latticexyz/store-sync) + +Added a `filters` option to store sync to allow filtering client data on tables and keys. Previously, it was only possible to filter on `tableIds`, but the new filter option allows for more flexible filtering by key. + +If you are building a large MUD application, you can use positional keys as a way to shard data and make it possible to load only the data needed in the client for a particular section of your app. We're using this already in Sky Strife to load match-specific data into match pages without having to load data for all matches, greatly improving load time and client performance. + +```ts +syncToRecs({ + ... + filters: [{ tableId: '0x...', key0: '0x...' }], +}); +``` + +The `tableIds` option is now deprecated and will be removed in the future, but is kept here for backwards compatibility. + +**[feat(world-modules): add ERC20 module (#1789)](https://github.com/latticexyz/mud/commit/83638373450af5d8f703a183a74107ef7efb4152)** (@latticexyz/world-modules) + +Added the `ERC20Module` to `@latticexyz/world-modules`. +This module allows the registration of `ERC20` tokens in an existing World. + +Important note: this module has not been audited yet, so any production use is discouraged for now. + +```solidity +import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; +import { IERC20Mintable } from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; +import { registerERC20 } from "@latticexyz/world-modules/src/modules/erc20-puppet/registerERC20.sol"; + +// The ERC20 module requires the Puppet module to be installed first +world.installModule(new PuppetModule(), new bytes(0)); + +// After the Puppet module is installed, new ERC20 tokens can be registered +IERC20Mintable token = registerERC20(world, "myERC20", ERC20MetadataData({ decimals: 18, name: "Token", symbol: "TKN" })); +``` + +**[feat(store-sync): sync to zustand (#1843)](https://github.com/latticexyz/mud/commit/fa77635839e760a9de5fc8959ee492b7a4d8a7cd)** (@latticexyz/store-sync) + +Added a Zustand storage adapter and corresponding `syncToZustand` method for use in vanilla and React apps. It's used much like the other sync methods, except it returns a bound store and set of typed tables. + +```ts +import { syncToZustand } from "@latticexyz/store-sync/zustand"; +import config from "contracts/mud.config"; + +const { tables, useStore, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToZustand({ + config, + ... +}); + +// in vanilla apps +const positions = useStore.getState().getRecords(tables.Position); + +// in React apps +const positions = useStore((state) => state.getRecords(tables.Position)); +``` + +This change will be shortly followed by an update to our templates that uses Zustand as the default client data store and sync method. + +**[feat(store): add experimental config resolve helper (#1826)](https://github.com/latticexyz/mud/commit/b1d41727d4b1964ad3cd907c1c2126b02172b413)** (@latticexyz/common) + +Added a `mapObject` helper to map the value of each property of an object to a new value. + +### Patch changes + +**[fix(create-mud): set store address in PostDeploy script (#1817)](https://github.com/latticexyz/mud/commit/c5148da763645e0adc1250245ea447904014bef2)** (create-mud) + +Updated templates' PostDeploy script to set store address so that tables can be used directly inside PostDeploy. + +**[fix(common,config): remove chalk usage (#1824)](https://github.com/latticexyz/mud/commit/3e057061da17dd2d0c5fd23e6f5a027bdf9a9223)** (@latticexyz/common, @latticexyz/config) + +Removed chalk usage from modules imported in client fix downstream client builds (vite in particular). + +--- + ## Version 2.0.0-next.12 Release date: Fri Oct 20 2023 diff --git a/packages/abi-ts/CHANGELOG.md b/packages/abi-ts/CHANGELOG.md index 07767ee824d..babf4db5424 100644 --- a/packages/abi-ts/CHANGELOG.md +++ b/packages/abi-ts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/abi-ts +## 2.0.0-next.13 + ## 2.0.0-next.12 ### Minor Changes diff --git a/packages/abi-ts/package.json b/packages/abi-ts/package.json index 9b6ffc048e3..5fe71a78afe 100644 --- a/packages/abi-ts/package.json +++ b/packages/abi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/abi-ts", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.", "repository": { "type": "git", diff --git a/packages/block-logs-stream/CHANGELOG.md b/packages/block-logs-stream/CHANGELOG.md index 20d1b42ae8c..abebc30ec21 100644 --- a/packages/block-logs-stream/CHANGELOG.md +++ b/packages/block-logs-stream/CHANGELOG.md @@ -1,5 +1,13 @@ # @latticexyz/block-logs-stream +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/block-logs-stream/package.json b/packages/block-logs-stream/package.json index 72b3160d017..4a9b94f4f36 100644 --- a/packages/block-logs-stream/package.json +++ b/packages/block-logs-stream/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/block-logs-stream", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Create a stream of EVM block logs for events", "repository": { "type": "git", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index c148d7618d6..44abb2a6157 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,27 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [52182f70] +- Updated dependencies [d7325e51] +- Updated dependencies [35348f83] +- Updated dependencies [83638373] +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/utils@2.0.0-next.13 + - @latticexyz/world-modules@2.0.0-next.13 + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/config@2.0.0-next.13 + - @latticexyz/protocol-parser@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + - @latticexyz/world@2.0.0-next.13 + - @latticexyz/abi-ts@2.0.0-next.13 + - @latticexyz/gas-report@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + - @latticexyz/services@2.0.0-next.13 + ## 2.0.0-next.12 ### Major Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 4c6b5a74ff0..bfe013dddec 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/cli", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Command line interface for mud", "repository": { "type": "git", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 423c7a176ff..1427545058d 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 2.0.0-next.13 + +### Minor Changes + +- b1d41727: Added a `mapObject` helper to map the value of each property of an object to a new value. + +### Patch Changes + +- 3e057061: Removed chalk usage from modules imported in client fix downstream client builds (vite in particular). + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Minor Changes diff --git a/packages/common/package.json b/packages/common/package.json index 97419abb1fb..9e8f3e34880 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/common", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Common low level logic shared between packages", "repository": { "type": "git", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 5e729fc2111..e737aadc3fa 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- 3e057061: Removed chalk usage from modules imported in client fix downstream client builds (vite in particular). +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 64231ff6d09..0c0f39cbb0d 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/config", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Config for Store and World", "repository": { "type": "git", diff --git a/packages/create-mud/CHANGELOG.md b/packages/create-mud/CHANGELOG.md index 666f04ec2fc..54ab545bb12 100644 --- a/packages/create-mud/CHANGELOG.md +++ b/packages/create-mud/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 2.0.0-next.13 + +### Major Changes + +- 78949f2c: Replaced the `react` template with a basic task list app using the new Zustand storage adapter and sync method. This new template better demonstrates the different ways of building with MUD and has fewer concepts to learn (i.e. just tables and records, no more ECS). + + For ECS-based React apps, you can use `react-ecs` template for the previous RECS storage adapter. + +### Patch Changes + +- c5148da7: Updated templates' PostDeploy script to set store address so that tables can be used directly inside PostDeploy. + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/create-mud/package.json b/packages/create-mud/package.json index 1bad1af6a7b..3110e88289c 100644 --- a/packages/create-mud/package.json +++ b/packages/create-mud/package.json @@ -1,6 +1,6 @@ { "name": "create-mud", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Create a new MUD project", "license": "MIT", "author": "Lattice ", diff --git a/packages/dev-tools/CHANGELOG.md b/packages/dev-tools/CHANGELOG.md index f92cca33a5f..6c770a2d1ff 100644 --- a/packages/dev-tools/CHANGELOG.md +++ b/packages/dev-tools/CHANGELOG.md @@ -1,5 +1,23 @@ # @latticexyz/dev-tools +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [52182f70] +- Updated dependencies [de47d698] +- Updated dependencies [f6d214e3] +- Updated dependencies [fa776358] +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/utils@2.0.0-next.13 + - @latticexyz/store-sync@2.0.0-next.13 + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/recs@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + - @latticexyz/world@2.0.0-next.13 + - @latticexyz/react@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index 91b69bf074c..1fd2ceb1987 100644 --- a/packages/dev-tools/package.json +++ b/packages/dev-tools/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/dev-tools", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "MUD developer tools", "repository": { "type": "git", @@ -50,12 +50,12 @@ "vitest": "0.31.4" }, "peerDependencies": { - "@latticexyz/common": "2.0.0-next.12", - "@latticexyz/recs": "2.0.0-next.12", - "@latticexyz/store": "2.0.0-next.12", - "@latticexyz/store-sync": "2.0.0-next.12", - "@latticexyz/utils": "2.0.0-next.12", - "@latticexyz/world": "2.0.0-next.12" + "@latticexyz/common": "2.0.0-next.13", + "@latticexyz/recs": "2.0.0-next.13", + "@latticexyz/store": "2.0.0-next.13", + "@latticexyz/store-sync": "2.0.0-next.13", + "@latticexyz/utils": "2.0.0-next.13", + "@latticexyz/world": "2.0.0-next.13" }, "publishConfig": { "access": "public" diff --git a/packages/ecs-browser/CHANGELOG.md b/packages/ecs-browser/CHANGELOG.md index cba492e611d..1962bbb9d52 100644 --- a/packages/ecs-browser/CHANGELOG.md +++ b/packages/ecs-browser/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/ecs-browser +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/ecs-browser/package.json b/packages/ecs-browser/package.json index 35a52fe2150..16bc62adac9 100644 --- a/packages/ecs-browser/package.json +++ b/packages/ecs-browser/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/ecs-browser", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/faucet/CHANGELOG.md b/packages/faucet/CHANGELOG.md index 05f8a1e1519..0cfdda502aa 100644 --- a/packages/faucet/CHANGELOG.md +++ b/packages/faucet/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/faucet +## 2.0.0-next.13 + ## 2.0.0-next.12 ### Minor Changes diff --git a/packages/faucet/package.json b/packages/faucet/package.json index 9e74955f2d5..978b22e7c77 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/faucet", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Faucet API for Lattice testnet", "repository": { "type": "git", diff --git a/packages/gas-report/CHANGELOG.md b/packages/gas-report/CHANGELOG.md index c77560338d7..f30804a2aa1 100644 --- a/packages/gas-report/CHANGELOG.md +++ b/packages/gas-report/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/gas-report/package.json b/packages/gas-report/package.json index a458228147d..4a6320057d0 100644 --- a/packages/gas-report/package.json +++ b/packages/gas-report/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/gas-report", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Gas reporter for specific lines within forge tests", "repository": { "type": "git", diff --git a/packages/network/CHANGELOG.md b/packages/network/CHANGELOG.md index c0e3c75dc99..aa5045b3d23 100644 --- a/packages/network/CHANGELOG.md +++ b/packages/network/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/network +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/network/package.json b/packages/network/package.json index e558cf5032e..b190195f64d 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/network", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/noise/CHANGELOG.md b/packages/noise/CHANGELOG.md index e00d038dd21..a539fd9659d 100644 --- a/packages/noise/CHANGELOG.md +++ b/packages/noise/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/noise/package.json b/packages/noise/package.json index 34afeb292a9..9f9a80b8ed2 100644 --- a/packages/noise/package.json +++ b/packages/noise/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/noise", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "license": "MIT", "type": "module", "exports": { diff --git a/packages/phaserx/CHANGELOG.md b/packages/phaserx/CHANGELOG.md index fdfd0521123..c92e83c4632 100644 --- a/packages/phaserx/CHANGELOG.md +++ b/packages/phaserx/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [52182f70] + - @latticexyz/utils@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/phaserx/package.json b/packages/phaserx/package.json index 682f6b443f1..e35e387fd03 100644 --- a/packages/phaserx/package.json +++ b/packages/phaserx/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/phaserx", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/protocol-parser/CHANGELOG.md b/packages/protocol-parser/CHANGELOG.md index d847173b349..76f6698723a 100644 --- a/packages/protocol-parser/CHANGELOG.md +++ b/packages/protocol-parser/CHANGELOG.md @@ -1,5 +1,14 @@ # @latticexyz/protocol-parser +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/protocol-parser/package.json b/packages/protocol-parser/package.json index 73996e4380a..258dcc8a717 100644 --- a/packages/protocol-parser/package.json +++ b/packages/protocol-parser/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/protocol-parser", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Parser utilities for the MUD protocol", "repository": { "type": "git", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 898a4318a22..1ca1f0727ed 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- @latticexyz/recs@2.0.0-next.13 +- @latticexyz/store@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index a818a80b5cf..28f969d25e0 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/react", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "React tools for MUD client.", "repository": { "type": "git", diff --git a/packages/recs/CHANGELOG.md b/packages/recs/CHANGELOG.md index f45017b4781..88f42c10c15 100644 --- a/packages/recs/CHANGELOG.md +++ b/packages/recs/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [52182f70] + - @latticexyz/utils@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/recs/package.json b/packages/recs/package.json index a7ba7fe5398..396d055ba52 100644 --- a/packages/recs/package.json +++ b/packages/recs/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/recs", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/schema-type/CHANGELOG.md b/packages/schema-type/CHANGELOG.md index 586237932de..ef7d10996af 100644 --- a/packages/schema-type/CHANGELOG.md +++ b/packages/schema-type/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/schema-type/package.json b/packages/schema-type/package.json index bf9cc7b7a2e..b74052bbe42 100644 --- a/packages/schema-type/package.json +++ b/packages/schema-type/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/schema-type", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "SchemaType enum for various languages", "repository": { "type": "git", diff --git a/packages/services/CHANGELOG.md b/packages/services/CHANGELOG.md index 7bc5d14ae18..961c4f19aaf 100644 --- a/packages/services/CHANGELOG.md +++ b/packages/services/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/services/package.json b/packages/services/package.json index bd9bcc0dd26..ca2073c527d 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/services", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "MUD services for enhanced interactions with on-chain ECS state", "repository": { "type": "git", diff --git a/packages/solecs/CHANGELOG.md b/packages/solecs/CHANGELOG.md index e3281cc00ff..6950079cd56 100644 --- a/packages/solecs/CHANGELOG.md +++ b/packages/solecs/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/solecs +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/solecs/package.json b/packages/solecs/package.json index 2afd8b795a1..1618a4c995e 100644 --- a/packages/solecs/package.json +++ b/packages/solecs/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/solecs", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/solhint-config-mud/CHANGELOG.md b/packages/solhint-config-mud/CHANGELOG.md index 5612268a880..54ec3b2049e 100644 --- a/packages/solhint-config-mud/CHANGELOG.md +++ b/packages/solhint-config-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/solhint-config-mud/package.json b/packages/solhint-config-mud/package.json index b254f1481b7..08433a1c53d 100644 --- a/packages/solhint-config-mud/package.json +++ b/packages/solhint-config-mud/package.json @@ -1,6 +1,6 @@ { "name": "solhint-config-mud", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/solhint-plugin-mud/CHANGELOG.md b/packages/solhint-plugin-mud/CHANGELOG.md index 5612268a880..54ec3b2049e 100644 --- a/packages/solhint-plugin-mud/CHANGELOG.md +++ b/packages/solhint-plugin-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/solhint-plugin-mud/package.json b/packages/solhint-plugin-mud/package.json index 4e1231aadae..a7ac22f1e35 100644 --- a/packages/solhint-plugin-mud/package.json +++ b/packages/solhint-plugin-mud/package.json @@ -1,6 +1,6 @@ { "name": "solhint-plugin-mud", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/std-client/CHANGELOG.md b/packages/std-client/CHANGELOG.md index 561c97e8de7..daa703c338c 100644 --- a/packages/std-client/CHANGELOG.md +++ b/packages/std-client/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-client +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/std-client/package.json b/packages/std-client/package.json index fbdf43d587b..0cea0e89c8c 100644 --- a/packages/std-client/package.json +++ b/packages/std-client/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/std-client", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/std-contracts/CHANGELOG.md b/packages/std-contracts/CHANGELOG.md index 565fffc1ec4..9a4fde43816 100644 --- a/packages/std-contracts/CHANGELOG.md +++ b/packages/std-contracts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-contracts +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/std-contracts/package.json b/packages/std-contracts/package.json index bb963604083..4551c35defb 100644 --- a/packages/std-contracts/package.json +++ b/packages/std-contracts/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/std-contracts", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/store-cache/CHANGELOG.md b/packages/store-cache/CHANGELOG.md index 15bb1e9c749..188aef70f92 100644 --- a/packages/store-cache/CHANGELOG.md +++ b/packages/store-cache/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/store-cache +## 2.0.0-next.13 + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/store-cache/package.json b/packages/store-cache/package.json index 3dd2877ddbb..c7d60a627d9 100644 --- a/packages/store-cache/package.json +++ b/packages/store-cache/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/store-cache", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "private": true } diff --git a/packages/store-indexer/CHANGELOG.md b/packages/store-indexer/CHANGELOG.md index 7acada1d3ca..8e2f1fa5e97 100644 --- a/packages/store-indexer/CHANGELOG.md +++ b/packages/store-indexer/CHANGELOG.md @@ -1,5 +1,35 @@ # @latticexyz/store-indexer +## 2.0.0-next.13 + +### Major Changes + +- f6d214e3: Removed `tableIds` filter option in favor of the more flexible `filters` option that accepts `tableId` and an optional `key0` and/or `key1` to filter data by tables and keys. + + If you were using an indexer client directly, you'll need to update your query: + + ```diff + await indexer.findAll.query({ + chainId, + address, + - tableIds: ['0x...'], + + filters: [{ tableId: '0x...' }], + }); + ``` + +### Patch Changes + +- Updated dependencies [de47d698] +- Updated dependencies [f6d214e3] +- Updated dependencies [fa776358] +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/store-sync@2.0.0-next.13 + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/block-logs-stream@2.0.0-next.13 + - @latticexyz/protocol-parser@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + ## 2.0.0-next.12 ### Minor Changes diff --git a/packages/store-indexer/package.json b/packages/store-indexer/package.json index da20550a2be..674460dae34 100644 --- a/packages/store-indexer/package.json +++ b/packages/store-indexer/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store-indexer", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Minimal Typescript indexer for Store", "repository": { "type": "git", diff --git a/packages/store-sync/CHANGELOG.md b/packages/store-sync/CHANGELOG.md index fa1a070d098..e64c8c10e92 100644 --- a/packages/store-sync/CHANGELOG.md +++ b/packages/store-sync/CHANGELOG.md @@ -1,5 +1,78 @@ # @latticexyz/store-sync +## 2.0.0-next.13 + +### Minor Changes + +- de47d698: Added an optional `tables` option to `syncToRecs` to allow you to sync from tables that may not be expressed by your MUD config. This will be useful for namespaced tables used by [ERC20](https://github.com/latticexyz/mud/pull/1789) and [ERC721](https://github.com/latticexyz/mud/pull/1844) token modules until the MUD config gains [namespace support](https://github.com/latticexyz/mud/issues/994). + + Here's how we use this in our example project with the `KeysWithValue` module: + + ```ts + syncToRecs({ + ... + tables: { + KeysWithValue: { + namespace: "keywval", + name: "Inventory", + tableId: resourceToHex({ type: "table", namespace: "keywval", name: "Inventory" }), + keySchema: { + valueHash: { type: "bytes32" }, + }, + valueSchema: { + keysWithValue: { type: "bytes32[]" }, + }, + }, + }, + ... + }); + ``` + +- f6d214e3: Added a `filters` option to store sync to allow filtering client data on tables and keys. Previously, it was only possible to filter on `tableIds`, but the new filter option allows for more flexible filtering by key. + + If you are building a large MUD application, you can use positional keys as a way to shard data and make it possible to load only the data needed in the client for a particular section of your app. We're using this already in Sky Strife to load match-specific data into match pages without having to load data for all matches, greatly improving load time and client performance. + + ```ts + syncToRecs({ + ... + filters: [{ tableId: '0x...', key0: '0x...' }], + }); + ``` + + The `tableIds` option is now deprecated and will be removed in the future, but is kept here for backwards compatibility. + +- fa776358: Added a Zustand storage adapter and corresponding `syncToZustand` method for use in vanilla and React apps. It's used much like the other sync methods, except it returns a bound store and set of typed tables. + + ```ts + import { syncToZustand } from "@latticexyz/store-sync/zustand"; + import config from "contracts/mud.config"; + + const { tables, useStore, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToZustand({ + config, + ... + }); + + // in vanilla apps + const positions = useStore.getState().getRecords(tables.Position); + + // in React apps + const positions = useStore((state) => state.getRecords(tables.Position)); + ``` + + This change will be shortly followed by an update to our templates that uses Zustand as the default client data store and sync method. + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/recs@2.0.0-next.13 + - @latticexyz/block-logs-stream@2.0.0-next.13 + - @latticexyz/protocol-parser@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + - @latticexyz/world@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Patch Changes diff --git a/packages/store-sync/package.json b/packages/store-sync/package.json index 3939841bc03..4a4cffd93aa 100644 --- a/packages/store-sync/package.json +++ b/packages/store-sync/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store-sync", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Utilities to sync MUD Store events with a client or cache", "repository": { "type": "git", diff --git a/packages/store/CHANGELOG.md b/packages/store/CHANGELOG.md index ce845d87435..6ffbb80fcd9 100644 --- a/packages/store/CHANGELOG.md +++ b/packages/store/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/config@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Major Changes diff --git a/packages/store/package.json b/packages/store/package.json index 58ddb59f982..2eb5299df01 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "Store", "repository": { "type": "git", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index a9482c26619..e77f1e7c563 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,5 +1,28 @@ # Change Log +## 2.0.0-next.13 + +### Major Changes + +- 52182f70: Removed `keccak256` and `keccak256Coord` hash utils in favor of [viem's `keccak256`](https://viem.sh/docs/utilities/keccak256.html#keccak256). + + ```diff + - import { keccak256 } from "@latticexyz/utils"; + + import { keccak256, toHex } from "viem"; + + - const hash = keccak256("some string"); + + const hash = keccak256(toHex("some string")); + ``` + + ```diff + - import { keccak256Coord } from "@latticexyz/utils"; + + import { encodeAbiParameters, keccak256, parseAbiParameters } from "viem"; + + const coord = { x: 1, y: 1 }; + - const hash = keccak256Coord(coord); + + const hash = keccak256(encodeAbiParameters(parseAbiParameters("int32, int32"), [coord.x, coord.y])); + ``` + ## 2.0.0-next.12 ## 2.0.0-next.11 diff --git a/packages/utils/package.json b/packages/utils/package.json index dee5c7593cb..ee602ac41a6 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/utils", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/world-modules/CHANGELOG.md b/packages/world-modules/CHANGELOG.md index 6d16878ded1..e287cde7164 100644 --- a/packages/world-modules/CHANGELOG.md +++ b/packages/world-modules/CHANGELOG.md @@ -1,5 +1,73 @@ # Change Log +## 2.0.0-next.13 + +### Minor Changes + +- d7325e51: Added the `ERC721Module` to `@latticexyz/world-modules`. + This module allows the registration of `ERC721` tokens in an existing World. + + Important note: this module has not been audited yet, so any production use is discouraged for now. + + ````solidity + import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; + import { ERC721MetadataData } from "@latticexyz/world-modules/src/modules/erc721-puppet/tables/ERC721Metadata.sol"; + import { IERC721Mintable } from "@latticexyz/world-modules/src/modules/erc721-puppet/IERC721Mintable.sol"; + import { registerERC721 } from "@latticexyz/world-modules/src/modules/erc721-puppet/registerERC721.sol"; + + // The ERC721 module requires the Puppet module to be installed first + world.installModule(new PuppetModule(), new bytes(0)); + + // After the Puppet module is installed, new ERC721 tokens can be registered + IERC721Mintable token = registerERC721(world, "myERC721", ERC721MetadataData({ name: "Token", symbol: "TKN", baseURI: "" }));``` + ```` + +- 35348f83: Added the `PuppetModule` to `@latticexyz/world-modules`. The puppet pattern allows an external contract to be registered as an external interface for a MUD system. + This allows standards like `ERC20` (that require a specific interface and events to be emitted by a unique contract) to be implemented inside a MUD World. + + The puppet serves as a proxy, forwarding all calls to the implementation system (also called the "puppet master"). + The "puppet master" system can emit events from the puppet contract. + + ```solidity + import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; + import { createPuppet } from "@latticexyz/world-modules/src/modules/puppet/createPuppet.sol"; + + // Install the puppet module + world.installModule(new PuppetModule(), new bytes(0)); + + // Register a new puppet for any system + // The system must implement the `CustomInterface`, + // and the caller must own the system's namespace + CustomInterface puppet = CustomInterface(createPuppet(world, )); + ``` + +- 83638373: Added the `ERC20Module` to `@latticexyz/world-modules`. + This module allows the registration of `ERC20` tokens in an existing World. + + Important note: this module has not been audited yet, so any production use is discouraged for now. + + ```solidity + import { PuppetModule } from "@latticexyz/world-modules/src/modules/puppet/PuppetModule.sol"; + import { IERC20Mintable } from "@latticexyz/world-modules/src/modules/erc20-puppet/IERC20Mintable.sol"; + import { registerERC20 } from "@latticexyz/world-modules/src/modules/erc20-puppet/registerERC20.sol"; + + // The ERC20 module requires the Puppet module to be installed first + world.installModule(new PuppetModule(), new bytes(0)); + + // After the Puppet module is installed, new ERC20 tokens can be registered + IERC20Mintable token = registerERC20(world, "myERC20", ERC20MetadataData({ decimals: 18, name: "Token", symbol: "TKN" })); + ``` + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/config@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + - @latticexyz/world@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Major Changes diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index d659e0ec468..5e679ca2706 100644 --- a/packages/world-modules/package.json +++ b/packages/world-modules/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world-modules", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "World modules", "repository": { "type": "git", diff --git a/packages/world/CHANGELOG.md b/packages/world/CHANGELOG.md index e30d8f85fdc..6401c9cd369 100644 --- a/packages/world/CHANGELOG.md +++ b/packages/world/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 2.0.0-next.13 + +### Patch Changes + +- Updated dependencies [3e057061] +- Updated dependencies [b1d41727] + - @latticexyz/common@2.0.0-next.13 + - @latticexyz/config@2.0.0-next.13 + - @latticexyz/store@2.0.0-next.13 + - @latticexyz/schema-type@2.0.0-next.13 + ## 2.0.0-next.12 ### Minor Changes diff --git a/packages/world/package.json b/packages/world/package.json index 596cf8ae471..87b97d9e94a 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "description": "World framework", "repository": { "type": "git",