Version 2.0.0-next.2
Major changes
feat(store-indexer): use fastify, move trpc to /trpc (#1232) (@latticexyz/store-indexer)
Adds a Fastify server in front of tRPC and puts tRPC endpoints under /trpc
to make way for other top-level endpoints (e.g. tRPC panel or other API frontends like REST or gRPC).
If you're using @latticexyz/store-sync
packages with an indexer (either createIndexerClient
or indexerUrl
argument of syncToRecs
), then you'll want to update your indexer URL:
createIndexerClient({
- url: "https://indexer.dev.linfra.xyz",
+ url: "https://indexer.dev.linfra.xyz/trpc",
});
syncToRecs({
...
- indexerUrl: "https://indexer.dev.linfra.xyz",
+ indexerUrl: "https://indexer.dev.linfra.xyz/trpc",
});
refactor(store): remove TableId library (#1279) (@latticexyz/store)
Remove TableId
library to simplify store
package
feat(create-mud): infer recs components from config (#1278) (@latticexyz/cli, @latticexyz/std-client, @latticexyz/store-sync, @latticexyz/store, @latticexyz/world, create-mud)
RECS components are now dynamically created and inferred from your MUD config when using syncToRecs
.
To migrate existing projects after upgrading to this MUD version:
-
Remove contractComponents.ts
from client/src/mud
-
Remove components
argument from syncToRecs
-
Update build:mud
and dev
scripts in contracts/package.json
to remove tsgen
- "build:mud": "mud tablegen && mud worldgen && mud tsgen --configPath mud.config.ts --out ../client/src/mud",
+ "build:mud": "mud tablegen && mud worldgen",
- "dev": "pnpm mud dev-contracts --tsgenOutput ../client/src/mud",
+ "dev": "pnpm mud dev-contracts",
feat: bump viem to 1.6.0 (#1308) (@latticexyz/block-logs-stream)
- removes our own
getLogs
function now that viem's getLogs
supports using multiple events
per RPC call. - removes
isNonPendingBlock
and isNonPendingLog
helpers now that viem narrows Block
and Log
types based on inputs - simplifies
groupLogsByBlockNumber
types and tests
feat(dev-tools): use new sync stack (#1284) (@latticexyz/dev-tools, create-mud)
MUD dev tools is updated to latest sync stack. You must now pass in all of its data requirements rather than relying on magic globals.
import { mount as mountDevTools } from "@latticexyz/dev-tools";
- mountDevTools();
+ mountDevTools({
+ config,
+ publicClient,
+ walletClient,
+ latestBlock$,
+ blockStorageOperations$,
+ worldAddress,
+ worldAbi,
+ write$,
+ // if you're using recs
+ recsWorld,
+ });
It's also advised to wrap dev tools so that it is only mounted during development mode. Here's how you do this with Vite:
// https://vitejs.dev/guide/env-and-mode.html
if (import.meta.env.DEV) {
mountDevTools({ ... });
}
Minor changes
feat(dev-tools): use new sync stack (#1284) (@latticexyz/common)
createContract
now has an onWrite
callback so you can observe writes. This is useful for wiring up the transanction log in MUD dev tools.
import { createContract, ContractWrite } from "@latticexyz/common";
import { Subject } from "rxjs";
const write$ = new Subject<ContractWrite>();
creactContract({
...
onWrite: (write) => write$.next(write),
});
feat: bump viem to 1.6.0 (#1308) (@latticexyz/common)
- adds
defaultPriorityFee
to mudFoundry
for better support with MUD's default anvil config and removes workaround in createContract
- improves nonce error detection using viem's custom errors
feat(store-sync,store-indexer): consolidate sync logic, add syncToSqlite (#1240) (@latticexyz/dev-tools, @latticexyz/store-indexer, @latticexyz/store-sync)
Store sync logic is now consolidated into a createStoreSync
function exported from @latticexyz/store-sync
. This simplifies each storage sync strategy to just a simple wrapper around the storage adapter. You can now sync to RECS with syncToRecs
or SQLite with syncToSqlite
and PostgreSQL support coming soon.
There are no breaking changes if you were just using syncToRecs
from @latticexyz/store-sync
or running the sqlite-indexer
binary from @latticexyz/store-indexer
.
feat(dev-tools): use new sync stack (#1284) (@latticexyz/react)
Adds a usePromise
hook that returns a native PromiseSettledResult
object.
const promise = fetch(url);
const result = usePromise(promise);
if (result.status === "idle" || result.status === "pending") {
return <>fetching</>;
}
if (result.status === "rejected") {
return <>error fetching: {String(result.reason)}</>;
}
if (result.status === "fulfilled") {
return <>fetch status: {result.value.status}</>;
}
Patch changes
feat: bump viem to 1.6.0 (#1308) (@latticexyz/block-logs-stream, @latticexyz/common, @latticexyz/dev-tools, @latticexyz/network, @latticexyz/protocol-parser, @latticexyz/schema-type, @latticexyz/std-client, @latticexyz/store-indexer, @latticexyz/store-sync, create-mud)
bump viem to 1.6.0
feat(dev-tools): improve support for non-store recs components (#1302) (@latticexyz/dev-tools, @latticexyz/store-sync)
Improves support for internal/client-only RECS components
feat: bump viem to 1.6.0 (#1308) (@latticexyz/store-sync)
remove usages of isNonPendingBlock
and isNonPendingLog
(fixed with more specific viem types)