Skip to content

Commit

Permalink
Version Packages (next)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 2, 2023
1 parent fa77635 commit d92319f
Show file tree
Hide file tree
Showing 63 changed files with 762 additions and 36 deletions.
11 changes: 11 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -67,6 +68,8 @@
"eighty-pots-report",
"eighty-tigers-argue",
"empty-planes-kiss",
"empty-starfishes-lick",
"fair-buckets-dress",
"fast-ears-hug",
"fast-zebras-drum",
"fast-zebras-promise",
Expand All @@ -75,6 +78,7 @@
"few-mirrors-reflect",
"few-papayas-leave",
"fifty-squids-eat",
"fifty-suits-itch",
"fifty-suits-shout",
"flat-trainers-marry",
"fluffy-moles-march",
Expand All @@ -84,9 +88,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",
Expand Down Expand Up @@ -168,21 +174,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",
Expand Down Expand Up @@ -210,6 +220,7 @@
"thin-terms-lay",
"thirty-cups-provide",
"three-lizards-shave",
"three-scissors-smile",
"tough-flowers-breathe",
"tricky-beds-kiss",
"tricky-carrots-talk",
Expand Down
183 changes: 183 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,186 @@
## 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...' }],
});
```

### 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, <systemId>));
```

**[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
Expand Down
Loading

0 comments on commit d92319f

Please sign in to comment.