@latticexyz/abi-ts
Advanced tools
Changelog
Version 2.0.0-next.11
feat(cli): remove backup/restore/force options from set-version (#1687) (@latticexyz/cli)
Removes .mudbackup
file handling and --backup
, --restore
, and --force
options from mud set-version
command.
To revert to a previous MUD version, use git diff
to find the version that you changed from and want to revert to and run pnpm mud set-version <prior-version>
again.
feat(world-modules): add SystemSwitch util (#1665) (@latticexyz/world-modules)
Since #1564 the World can no longer call itself via an external call.
This made the developer experience of calling other systems via root systems worse, since calls from root systems are executed from the context of the World.
The recommended approach is to use delegatecall
to the system if in the context of a root system, and an external call via the World if in the context of a non-root system.
To bring back the developer experience of calling systems from other sysyems without caring about the context in which the call is executed, we added the SystemSwitch
util.
- // Instead of calling the system via an external call to world...
- uint256 value = IBaseWorld(_world()).callMySystem();
+ // ...you can now use the `SystemSwitch` util.
+ // This works independent of whether used in a root system or non-root system.
+ uint256 value = abi.decode(SystemSwitch.call(abi.encodeCall(IBaseWorld.callMySystem, ()), (uint256));
Note that if you already know your system is always executed as non-root system, you can continue to use the approach of calling other systems via the IBaseWorld(world)
.
refactor(common): move createContract
's internal write logic to writeContract
(#1693) (@latticexyz/common)
createContract
into its own writeContract
method so that it can be used outside of the contract instance, and for consistency with viem.createContract
in favor of getContract
for consistency with viem.createNonceManager
's BroadcastChannel
setup and moves out the notion of a "nonce manager ID" to getNonceManagerId
so we can create an internal cache with getNonceManager
for use in writeContract
.If you were using the createNonceManager
before, you'll just need to rename publicClient
argument to client
:
const publicClient = createPublicClient({ ... });
- const nonceManager = createNonceManager({ publicClient, ... });
+ const nonceManager = createNonceManager({ client: publicClient, ... });
feat(gas-reporter): allow gas-reporter to parse stdin (#1688) (@latticexyz/gas-report)
Allow the gas-report
CLI to parse logs via stdin
, so it can be used with custom test commands (e.g. mud test
).
Usage:
GAS_REPORTER_ENABLED=true forge test -vvv | pnpm gas-report --stdin
feat(store-sync): export postgres column type helpers (#1699) (@latticexyz/store-sync)
Export postgres column type helpers from @latticexyz/store-sync
.
fix(common): workaround for zero base fee (#1689) (@latticexyz/common)
Adds viem workaround for zero base fee used by MUD's anvil config
fix(world): register store namespace during initialization (#1712) (@latticexyz/world)
Register the store
namespace in the CoreModule
.
Since namespaces are a World concept, registering the Store's internal tables does not automatically register the Store's namespace, so we do this manually during initialization in the CoreModule
.
build: bump viem and abitype (#1684) (@latticexyz/block-logs-stream, @latticexyz/cli, @latticexyz/common, @latticexyz/dev-tools, @latticexyz/faucet, @latticexyz/protocol-parser, @latticexyz/schema-type, @latticexyz/store-indexer, @latticexyz/store-sync, @latticexyz/store, create-mud)
Bump viem to 1.14.0 and abitype to 0.9.8
feat(gas-report): add more logs to stdin piping (#1694) (@latticexyz/gas-report)
Pass through stdin
logs in gas-report
. Since the script piping in logs to gas-report
can be long-running, it is useful to see its logs to know if it's stalling.
fix(protocol-parser): allow arbitrary key order when encoding values (#1674) (@latticexyz/protocol-parser)
Allow arbitrary key order when encoding values