Skip to content

Releases: latticexyz/mud

@latticexyz/[email protected]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release

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 and valueSchema into a single schema with a separate key 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 to schema and define the table key 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 into schema.

     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 and valueSchema, some of the defaults have changed. Shorthands now use an id: "bytes32" field by default rather than key: "bytes32" and corresponding key: ["id"]. To keep previous behavior, you may have to manually define your schema with the previous key and value 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 than keySchema is provided:

    -keySchema: {}
    +key: []

    Offchain tables are now defined as a table type instead an offchainOnly 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 to EncodedLengths for consistency.

  • 252a185: Migrated to new config format.

Minor Changes

  • 5debcca: registerRootFunctionSelector now expects a systemFunctionSignature instead of a systemFunctionSelector. 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 with HelloStore, 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 initializes StoreCore. Store extends StoreKernel with the IStoreRegistration interface. StoreData is removed as a separate interface/contract. World now extends StoreKernel (since the registration methods are added via the InitModule).

  • be18b75: IWorldKernel now inherits IModuleErrors so it can render the correct errors if the World reverts when delegatecalled with Module code.

  • 95f64c8: Renamed the functionSelector key in the FunctionSelectors table to worldFunctionSelector. This clarifies that FunctionSelectors 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]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release

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 to EncodedLengths 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]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release
@latticexyz/[email protected]

@latticexyz/[email protected]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release

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 and valueSchema into a single schema with a separate key 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 to schema and define the table key 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 into schema.

     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 and valueSchema, some of the defaults have changed. Shorthands now use an id: "bytes32" field by default rather than key: "bytes32" and corresponding key: ["id"]. To keep previous behavior, you may have to manually define your schema with the previous key and value 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 than keySchema is provided:

    -keySchema: {}
    +key: []

    Offchain tables are now defined as a table type instead an offchainOnly 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 the Store_SpliceDynamicData event. This enables indexers to store dynamic data as a blob per dynamic field without a schema lookup.

  • 3e7d83d: Renamed PackedCounter to EncodedLengths 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 initializes StoreCore. Store extends StoreKernel with the IStoreRegistration interface. StoreData is removed as a separate interface/contract. World now extends StoreKernel (since the registration methods are added via the InitModule).

  • 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 import IStoreEvents 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 includes FieldLayout, PackedCounter, Schema, and Slice. This interfaces are inherited by IStore, ensuring that all possible errors are included in the IStore ABI for proper decoding in the frontend.

  • 190fdd1: Restored Bytes.sliceN helpers that were previously (mistakenly) removed and renamed them to Bytes.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 to IStoreEvents 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]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release

Major Changes

  • 8193136: Added dynamicFieldIndex to the Store_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 running createStoreSync. It defaults to latest (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 using FOLLOW_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

@latticexyz/[email protected]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release

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 running createStoreSync. It defaults to latest (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 using FOLLOW_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

@latticexyz/[email protected]

21 Mar 17:31
43b0fdf
Compare
Choose a tag to compare
Pre-release
@latticexyz/[email protected]

@latticexyz/[email protected]

21 Mar 17:30
43b0fdf
Compare
Choose a tag to compare
Pre-release

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]

21 Mar 17:30
43b0fdf
Compare
Choose a tag to compare
Pre-release

Patch Changes

@latticexyz/[email protected]

21 Mar 17:30
43b0fdf
Compare
Choose a tag to compare
Pre-release

Patch Changes