Releases: latticexyz/mud
@latticexyz/[email protected]
Major Changes
-
c9ee5e4: Store and World configs have been rebuilt with strong types. The shape of these configs have also changed slightly for clarity, the biggest change of which is merging of
keySchema
andvalueSchema
into a singleschema
with a separatekey
for a table's primary key.To migrate, first update the imported config method:
-import { mudConfig } from "@latticexyz/world/register"; +import { defineWorld } from "@latticexyz/world"; -export default mudConfig({ +export default defineWorld({
Note that if you are only using Store, you will need to import
defineStore
from@latticexyz/store
.Then migrate the table key by renaming
keySchema
toschema
and define the tablekey
with each field name from your key schema:export default defineWorld({ tables: { Position: { - keySchema: { + schema: { player: "address", }, valueSchema: { x: "int32", y: "int32", }, + key: ['player'], }, }, });
Now we can merge the
valueSchema
intoschema
.export default defineWorld({ tables: { Position: { schema: { player: "address", - }, - valueSchema: { x: "int32", y: "int32", }, key: ['player'], }, }, });
If you previously used the table config shorthand without the full
keySchema
andvalueSchema
, some of the defaults have changed. Shorthands now use anid: "bytes32"
field by default rather thankey: "bytes32"
and correspondingkey: ["id"]
. To keep previous behavior, you may have to manually define yourschema
with the previouskey
andvalue
fields.export default defineWorld({ tables: { - OwnedBy: "address", + OwnedBy: { + schema: { + key: "bytes32", + value: "address", + }, + key: ["key"], + }, }, });
Singleton tables are defined similarly, where an empty
key
rather thankeySchema
is provided:-keySchema: {} +key: []
Offchain tables are now defined as a table
type
instead anoffchainOnly
boolean:-offchainOnly: true +type: 'offchainTable'
All codegen options have moved under
codegen
:export default defineWorld({ - codegenDirectory: "…", + codegen: { + outputDirectory: "…", + }, tables: { Position: { schema: { player: "address", x: "int32", y: "int32", }, key: ['player'], - directory: "…", - dataStruct: false, + codegen: { + outputDirectory: "…", + dataStruct: false, + }, }, }, });
-
9aa5e78: Set the protocol version to
2.0.0
for each Store and World. -
3e7d83d: Renamed
PackedCounter
toEncodedLengths
for consistency. -
252a185: Migrated to new config format.
Minor Changes
-
5debcca:
registerRootFunctionSelector
now expects asystemFunctionSignature
instead of asystemFunctionSelector
. Internally, we compute the selector from the signature. This allows us to track system function signatures that are registered at the root so we can later generate ABIs for these systems. -
3042f86: Moved key schema and value schema methods to constants in code-generated table libraries for less bytecode and less gas in register/install methods.
-console.log(SomeTable.getKeySchema()); +console.log(SomeTable._keySchema); -console.log(SomeTable.getValueSchema()); +console.log(SomeTable._valueSchema);
-
d7b1c58: Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.
Some viem APIs have changed and we've updated
getContract
to reflect those changes and keep it aligned with viem. It's one small code change:const worldContract = getContract({ address: worldAddress, abi: IWorldAbi, - publicClient, - walletClient, + client: { public: publicClient, wallet: walletClient }, });
Patch Changes
-
8f49c27: Attempting to deploy multiple systems where there are overlapping system IDs now throws an error.
-
4423604: Moved table ID and field layout constants in code-generated table libraries from the file level into the library, for clearer access and cleaner imports.
-import { SomeTable, SomeTableTableId } from "./codegen/tables/SomeTable.sol"; +import { SomeTable } from "./codegen/tables/SomeTable.sol"; -console.log(SomeTableTableId); +console.log(SomeTable._tableId); -console.log(SomeTable.getFieldLayout()); +console.log(SomeTable._fieldLayout);
-
3be4dee: Added salt to the
WorldDeployed
event. -
1a82c27: Added system signatures to the
FunctionSignatures
table, so they can be used to generate system ABIs and decode system calls made via the world. -
86766ce: Created an
IWorldEvents
interface withHelloStore
, so all World events are defined in a single interface. -
93390d8: Added an
abstract
StoreKernel
contract, which includes all Store interfaces except for registration, and implements write methods,protocolVersion
and initializesStoreCore
.Store
extendsStoreKernel
with theIStoreRegistration
interface.StoreData
is removed as a separate interface/contract.World
now extendsStoreKernel
(since the registration methods are added via theInitModule
). -
be18b75:
IWorldKernel
now inheritsIModuleErrors
so it can render the correct errors if the World reverts when delegatecalled with Module code. -
95f64c8: Renamed the
functionSelector
key in theFunctionSelectors
table toworldFunctionSelector
. This clarifies thatFunctionSelectors
is for world function selectors and can be used to generate the world ABI. -
Updated dependencies [c9ee5e4]
-
Updated dependencies [8269307]
-
Updated dependencies [d5c0682]
-
Updated dependencies [01e46d9]
-
Updated dependencies [2c920de]
-
Updated dependencies [4423604]
-
Updated dependencies [9aa5e78]
-
Updated dependencies [307abab]
-
Updated dependencies [c991c71]
-
Updated dependencies [b38c096]
-
Updated dependencies [e34d117]
-
Updated dependencies [190fdd1]
-
Updated dependencies [db314a7]
-
Updated dependencies [5926765]
-
Updated dependencies [8193136]
-
Updated dependencies [93390d8]
-
Updated dependencies [144c0d8]
-
Updated dependencies [c58da9a]
-
Updated dependencies [3042f86]
-
Updated dependencies [d7b1c58]
-
Updated dependencies [3e7d83d]
-
Updated dependencies [252a185]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
Major Changes
- 252a185: Migrated to new config format.
Minor Changes
-
3042f86: Moved key schema and value schema methods to constants in code-generated table libraries for less bytecode and less gas in register/install methods.
-console.log(SomeTable.getKeySchema()); +console.log(SomeTable._keySchema); -console.log(SomeTable.getValueSchema()); +console.log(SomeTable._valueSchema);
Patch Changes
-
4be22ba: ERC20 and ERC721 implementations now always register the token namespace, instead of checking if it has already been registered. This prevents issues with registering the namespace beforehand, namely that only the owner of a system can create a puppet for it.
-
4423604: Moved table ID and field layout constants in code-generated table libraries from the file level into the library, for clearer access and cleaner imports.
-import { SomeTable, SomeTableTableId } from "./codegen/tables/SomeTable.sol"; +import { SomeTable } from "./codegen/tables/SomeTable.sol"; -console.log(SomeTableTableId); +console.log(SomeTable._tableId); -console.log(SomeTable.getFieldLayout()); +console.log(SomeTable._fieldLayout);
-
3e7d83d: Renamed
PackedCounter
toEncodedLengths
for consistency. -
Updated dependencies [c9ee5e4]
-
Updated dependencies [8f49c27]
-
Updated dependencies [8269307]
-
Updated dependencies [d5c0682]
-
Updated dependencies [01e46d9]
-
Updated dependencies [2c920de]
-
Updated dependencies [4423604]
-
Updated dependencies [3be4dee]
-
Updated dependencies [5debcca]
-
Updated dependencies [9aa5e78]
-
Updated dependencies [307abab]
-
Updated dependencies [c991c71]
-
Updated dependencies [b38c096]
-
Updated dependencies [e34d117]
-
Updated dependencies [190fdd1]
-
Updated dependencies [db314a7]
-
Updated dependencies [5926765]
-
Updated dependencies [1a82c27]
-
Updated dependencies [8193136]
-
Updated dependencies [86766ce]
-
Updated dependencies [93390d8]
-
Updated dependencies [144c0d8]
-
Updated dependencies [c58da9a]
-
Updated dependencies [be18b75]
-
Updated dependencies [3042f86]
-
Updated dependencies [d7b1c58]
-
Updated dependencies [95f64c8]
-
Updated dependencies [3e7d83d]
-
Updated dependencies [252a185]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
@latticexyz/[email protected]
@latticexyz/[email protected]
Major Changes
-
c9ee5e4: Store and World configs have been rebuilt with strong types. The shape of these configs have also changed slightly for clarity, the biggest change of which is merging of
keySchema
andvalueSchema
into a singleschema
with a separatekey
for a table's primary key.To migrate, first update the imported config method:
-import { mudConfig } from "@latticexyz/world/register"; +import { defineWorld } from "@latticexyz/world"; -export default mudConfig({ +export default defineWorld({
Note that if you are only using Store, you will need to import
defineStore
from@latticexyz/store
.Then migrate the table key by renaming
keySchema
toschema
and define the tablekey
with each field name from your key schema:export default defineWorld({ tables: { Position: { - keySchema: { + schema: { player: "address", }, valueSchema: { x: "int32", y: "int32", }, + key: ['player'], }, }, });
Now we can merge the
valueSchema
intoschema
.export default defineWorld({ tables: { Position: { schema: { player: "address", - }, - valueSchema: { x: "int32", y: "int32", }, key: ['player'], }, }, });
If you previously used the table config shorthand without the full
keySchema
andvalueSchema
, some of the defaults have changed. Shorthands now use anid: "bytes32"
field by default rather thankey: "bytes32"
and correspondingkey: ["id"]
. To keep previous behavior, you may have to manually define yourschema
with the previouskey
andvalue
fields.export default defineWorld({ tables: { - OwnedBy: "address", + OwnedBy: { + schema: { + key: "bytes32", + value: "address", + }, + key: ["key"], + }, }, });
Singleton tables are defined similarly, where an empty
key
rather thankeySchema
is provided:-keySchema: {} +key: []
Offchain tables are now defined as a table
type
instead anoffchainOnly
boolean:-offchainOnly: true +type: 'offchainTable'
All codegen options have moved under
codegen
:export default defineWorld({ - codegenDirectory: "…", + codegen: { + outputDirectory: "…", + }, tables: { Position: { schema: { player: "address", x: "int32", y: "int32", }, key: ['player'], - directory: "…", - dataStruct: false, + codegen: { + outputDirectory: "…", + dataStruct: false, + }, }, }, });
-
9aa5e78: Set the protocol version to
2.0.0
for each Store and World. -
8193136: Added
dynamicFieldIndex
to theStore_SpliceDynamicData
event. This enables indexers to store dynamic data as a blob per dynamic field without a schema lookup. -
3e7d83d: Renamed
PackedCounter
toEncodedLengths
for consistency. -
252a185: Migrated to new config format.
Minor Changes
-
93390d8: Added an
abstract
StoreKernel
contract, which includes all Store interfaces except for registration, and implements write methods,protocolVersion
and initializesStoreCore
.Store
extendsStoreKernel
with theIStoreRegistration
interface.StoreData
is removed as a separate interface/contract.World
now extendsStoreKernel
(since the registration methods are added via theInitModule
). -
144c0d8: Replaced the static array length getters in table libraries with constants.
-
3042f86: Moved key schema and value schema methods to constants in code-generated table libraries for less bytecode and less gas in register/install methods.
-console.log(SomeTable.getKeySchema()); +console.log(SomeTable._keySchema); -console.log(SomeTable.getValueSchema()); +console.log(SomeTable._valueSchema);
-
d7b1c58: Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.
Some viem APIs have changed and we've updated
getContract
to reflect those changes and keep it aligned with viem. It's one small code change:const worldContract = getContract({ address: worldAddress, abi: IWorldAbi, - publicClient, - walletClient, + client: { public: publicClient, wallet: walletClient }, });
Patch Changes
-
2c920de: Refactored
StoreCore
to importIStoreEvents
instead of defining the events twice. -
4423604: Moved table ID and field layout constants in code-generated table libraries from the file level into the library, for clearer access and cleaner imports.
-import { SomeTable, SomeTableTableId } from "./codegen/tables/SomeTable.sol"; +import { SomeTable } from "./codegen/tables/SomeTable.sol"; -console.log(SomeTableTableId); +console.log(SomeTable._tableId); -console.log(SomeTable.getFieldLayout()); +console.log(SomeTable._fieldLayout);
-
c991c71: Added interfaces for all errors that are used by
StoreCore
, which includesFieldLayout
,PackedCounter
,Schema
, andSlice
. This interfaces are inherited byIStore
, ensuring that all possible errors are included in theIStore
ABI for proper decoding in the frontend. -
190fdd1: Restored
Bytes.sliceN
helpers that were previously (mistakenly) removed and renamed them toBytes.getBytesN
.If you're upgrading an existing MUD project, you can rerun codegen with
mud build
to update your table libraries to the new function names. -
c58da9a: Moved the
HelloStore
toIStoreEvents
so all Store events are defined in the same interface. -
Updated dependencies [8269307]
-
Updated dependencies [d5c0682]
-
Updated dependencies [01e46d9]
-
Updated dependencies [4423604]
-
Updated dependencies [307abab]
-
Updated dependencies [b38c096]
-
Updated dependencies [e34d117]
-
Updated dependencies [db314a7]
-
Updated dependencies [5926765]
-
Updated dependencies [d7b1c58]
-
Updated dependencies [3e7d83d]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
Major Changes
-
8193136: Added
dynamicFieldIndex
to theStore_SpliceDynamicData
event. This enables indexers to store dynamic data as a blob per dynamic field without a schema lookup. -
adc6822: PostgreSQL sync/indexer now uses
{storeAddress}
for its database schema names and{namespace}__{tableName}
for its database table names (or just{tableName}
for root namespace), to be more consistent with the rest of the MUD codebase.For namespaced tables:
- SELECT * FROM 0xfff__some_ns.some_table + SELECT * FROM 0xfff.some_ns__some_table
For root tables:
- SELECT * FROM 0xfff__.some_table + SELECT * FROM 0xfff.some_table
SQLite sync/indexer now uses snake case for its table names and column names for easier writing of queries and to better match PostgreSQL sync/indexer naming.
- SELECT * FROM 0xfFf__someNS__someTable + SELECT * FROM 0xfff__some_ns__some_table
-
252a185: Migrated to new config format.
Minor Changes
-
3622e39: Added a
followBlockTag
option to configure which block number to follow when runningcreateStoreSync
. It defaults tolatest
(current behavior), which is recommended for individual clients so that you always have the latest chain state.Indexers now default to
safe
to avoid issues with reorgs and load-balanced RPCs being out of sync. This means indexers will be slightly behind the latest block number, but clients can quickly catch up. Indexers can override this setting usingFOLLOW_BLOCK_TAG
environment variable. -
d7b1c58: Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.
Some viem APIs have changed and we've updated
getContract
to reflect those changes and keep it aligned with viem. It's one small code change:const worldContract = getContract({ address: worldAddress, abi: IWorldAbi, - publicClient, - walletClient, + client: { public: publicClient, wallet: walletClient }, });
Patch Changes
- d5c0682: Updated all human-readable resource IDs to use
{namespace}__{name}
for consistency with world function signatures. - 3f5d33a: Fixes an issue with Zustand store sync where multiple updates to a record for a key in the same block did not get tracked and applied properly.
- Updated dependencies [c9ee5e4]
- Updated dependencies [8f49c27]
- Updated dependencies [8269307]
- Updated dependencies [d5c0682]
- Updated dependencies [01e46d9]
- Updated dependencies [2c920de]
- Updated dependencies [4423604]
- Updated dependencies [3be4dee]
- Updated dependencies [5debcca]
- Updated dependencies [9aa5e78]
- Updated dependencies [307abab]
- Updated dependencies [c991c71]
- Updated dependencies [b38c096]
- Updated dependencies [e34d117]
- Updated dependencies [190fdd1]
- Updated dependencies [db314a7]
- Updated dependencies [5926765]
- Updated dependencies [1a82c27]
- Updated dependencies [8193136]
- Updated dependencies [86766ce]
- Updated dependencies [93390d8]
- Updated dependencies [144c0d8]
- Updated dependencies [c58da9a]
- Updated dependencies [be18b75]
- Updated dependencies [3042f86]
- Updated dependencies [d7b1c58]
- Updated dependencies [95f64c8]
- Updated dependencies [3e7d83d]
- Updated dependencies [252a185]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
Major Changes
-
adc6822: PostgreSQL sync/indexer now uses
{storeAddress}
for its database schema names and{namespace}__{tableName}
for its database table names (or just{tableName}
for root namespace), to be more consistent with the rest of the MUD codebase.For namespaced tables:
- SELECT * FROM 0xfff__some_ns.some_table + SELECT * FROM 0xfff.some_ns__some_table
For root tables:
- SELECT * FROM 0xfff__.some_table + SELECT * FROM 0xfff.some_table
SQLite sync/indexer now uses snake case for its table names and column names for easier writing of queries and to better match PostgreSQL sync/indexer naming.
- SELECT * FROM 0xfFf__someNS__someTable + SELECT * FROM 0xfff__some_ns__some_table
Minor Changes
-
3622e39: Added a
followBlockTag
option to configure which block number to follow when runningcreateStoreSync
. It defaults tolatest
(current behavior), which is recommended for individual clients so that you always have the latest chain state.Indexers now default to
safe
to avoid issues with reorgs and load-balanced RPCs being out of sync. This means indexers will be slightly behind the latest block number, but clients can quickly catch up. Indexers can override this setting usingFOLLOW_BLOCK_TAG
environment variable. -
d7b1c58: Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.
Some viem APIs have changed and we've updated
getContract
to reflect those changes and keep it aligned with viem. It's one small code change:const worldContract = getContract({ address: worldAddress, abi: IWorldAbi, - publicClient, - walletClient, + client: { public: publicClient, wallet: walletClient }, });
Patch Changes
- Updated dependencies [c9ee5e4]
- Updated dependencies [3622e39]
- Updated dependencies [8269307]
- Updated dependencies [d5c0682]
- Updated dependencies [01e46d9]
- Updated dependencies [2c920de]
- Updated dependencies [4423604]
- Updated dependencies [9aa5e78]
- Updated dependencies [307abab]
- Updated dependencies [c991c71]
- Updated dependencies [b38c096]
- Updated dependencies [e34d117]
- Updated dependencies [190fdd1]
- Updated dependencies [db314a7]
- Updated dependencies [5926765]
- Updated dependencies [8193136]
- Updated dependencies [3f5d33a]
- Updated dependencies [93390d8]
- Updated dependencies [144c0d8]
- Updated dependencies [c58da9a]
- Updated dependencies [3042f86]
- Updated dependencies [d7b1c58]
- Updated dependencies [3e7d83d]
- Updated dependencies [adc6822]
- Updated dependencies [252a185]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
@latticexyz/[email protected]
@latticexyz/[email protected]
Major Changes
- b38c096: Moved all existing exports to a
/internal
import path to indicate that these are now internal-only and deprecated. We'll be replacing these types and functions with new ones that are compatible with our new, strongly-typed config.
Minor Changes
-
d7b1c58: Upgraded all packages and templates to viem v2.7.12 and abitype v1.0.0.
Some viem APIs have changed and we've updated
getContract
to reflect those changes and keep it aligned with viem. It's one small code change:const worldContract = getContract({ address: worldAddress, abi: IWorldAbi, - publicClient, - walletClient, + client: { public: publicClient, wallet: walletClient }, });
@latticexyz/[email protected]
Patch Changes
- Updated dependencies [b38c096]
- Updated dependencies [d7b1c58]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
@latticexyz/[email protected]
Patch Changes
- 01e46d9: Removed some unused files, namely
curry
in@latticexyz/common
anduseDeprecatedComputedValue
from@latticexyz/react
. - Updated dependencies [c9ee5e4]
- Updated dependencies [2c920de]
- Updated dependencies [4423604]
- Updated dependencies [9aa5e78]
- Updated dependencies [c991c71]
- Updated dependencies [190fdd1]
- Updated dependencies [8193136]
- Updated dependencies [93390d8]
- Updated dependencies [144c0d8]
- Updated dependencies [c58da9a]
- Updated dependencies [3042f86]
- Updated dependencies [d7b1c58]
- Updated dependencies [3e7d83d]
- Updated dependencies [252a185]
- @latticexyz/[email protected]
- @latticexyz/[email protected]