Skip to content

@latticexyz/[email protected]

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 21 Mar 17:30
· 450 commits to main since this release
43b0fdf

Major Changes

  • 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);

Minor Changes

  • 5926765: Added viem custom client actions that work the same as MUD's now-deprecated getContract, writeContract, and sendTransaction wrappers. Templates have been updated to reflect the new patterns.

    You can migrate your own code like this:

    -import { createWalletClient } from "viem";
    -import { getContract, writeContract, sendTransaction } from "@latticexyz/common";
    +import { createWalletClient, getContract } from "viem";
    +import { transactionQueue, writeObserver } from "@latticexyz/common/actions";
    
    -const walletClient = createWalletClient(...);
    +const walletClient = createWalletClient(...)
    +  .extend(transactionQueue())
    +  .extend(writeObserver({ onWrite });
    
     const worldContract = getContract({
       client: { publicClient, walletClient },
    -  onWrite,
     });
  • 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

  • 8269307: waitForIdle now falls back to setTimeout for environments without requestIdleCallback.

  • d5c0682: Updated all human-readable resource IDs to use {namespace}__{name} for consistency with world function signatures.

  • 01e46d9: Removed some unused files, namely curry in @latticexyz/common and useDeprecatedComputedValue from @latticexyz/react.

  • 307abab: resourceToLabel now correctly returns just the resource name if its in the root namespace.

  • e34d117: Moved the transaction simulation step to just before sending the transaction in our transaction queue actions (sendTransaction and writeContract).

    This helps avoid cascading transaction failures for deep queues or when a transaction succeeding depends on the value of the previous.

  • db314a7: Upgraded prettier version to 3.2.5 and prettier-plugin-solidity version to 1.3.1.

  • Updated dependencies [b38c096]

  • Updated dependencies [d7b1c58]