mud

MUD is a framework for building ambitious onchain applications

MIT License

Downloads
318.4K
Stars
643
Committers
80

Bot releases are visible (Hide)

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Minor Changes

  • 1faf7f69: Added Zustand support to Dev Tools:

    const { syncToZustand } from "@latticexyz/store-sync";
    const { mount as mountDevTools } from "@latticexyz/dev-tools";
    
    const { useStore } = syncToZustand({ ... });
    
    mountDevTools({
      ...
      useStore,
    });
    

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes

  • aacffcb5: Pinned prettier-plugin-solidity version to 1.1.3
  • Updated dependencies [bb91edaa]
mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Minor Changes

  • bdb46fe3: Deploys now validate contract size before deploying and warns when a contract is over or close to the size limit (24kb). This should help identify the most common cause of "evm revert" errors during system and module contract deploys.

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

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.

    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.

    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, <systemId>));
    
  • 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.

    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

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

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 and ERC721 token modules until the MUD config gains namespace support.

    Here's how we use this in our example project with the KeysWithValue module:

    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.

    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.

    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

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Major Changes

  • 52182f70: Removed keccak256 and keccak256Coord hash utils in favor of viem's keccak256.

    - import { keccak256 } from "@latticexyz/utils";
    + import { keccak256, toHex } from "viem";
    
    - const hash = keccak256("some string");
    + const hash = keccak256(toHex("some string"));
    
    - 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]));
    
mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

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:

      await indexer.findAll.query({
        chainId,
        address,
    -   tableIds: ['0x...'],
    +   filters: [{ tableId: '0x...' }],
      });
    

Patch Changes

mud - [email protected]

Published by github-actions[bot] 12 months ago

mud - [email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] 12 months ago

Patch Changes