MUD is a framework for building ambitious onchain applications
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] about 1 year ago
c963b46c
, 5c965a91
, 60cfd089
, afdba793
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
3fb9ce28
, 35c9f33d
, b02f9d0e
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
#1258 6c673325
Thanks @holic! - Add tableIdToHex
and hexToTableId
pure functions and move/deprecate TableId
.
Updated dependencies [3236f799
, c963b46c
, 3fb9ce28
, 35c9f33d
, 5c965a91
, b02f9d0e
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, afdba793
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
e259ef79
, 60cfd089
, 6c673325
, afdba793
]:
Published by github-actions[bot] about 1 year ago
#1258 6c673325
Thanks @holic! - Add tableIdToHex
and hexToTableId
pure functions and move/deprecate TableId
.
Updated dependencies [3fb9ce28
, 35c9f33d
, e259ef79
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, afdba793
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
#1214 60cfd089
Thanks @holic! - Templates and examples now use MUD's new sync packages, all built on top of viem. This greatly speeds up and stabilizes our networking code and improves types throughout.
These new sync packages come with support for our recs
package, including encodeEntity
and decodeEntity
utilities for composite keys.
If you're using store-cache
and useRow
/useRows
, you should wait to upgrade until we have a suitable replacement for those libraries. We're working on a sql.js-powered sync module that will replace store-cache
.
Migrate existing RECS apps to new sync packages
As you migrate, you may find some features replaced, removed, or not included by default. Please open an issue and let us know if we missed anything.
Add @latticexyz/store-sync
package to your app's client
package and make sure viem
is pinned to version 1.3.1
(otherwise you may get type errors)
In your supportedChains.ts
, replace foundry
chain with our new mudFoundry
chain.
- import { foundry } from "viem/chains";
- import { MUDChain, latticeTestnet } from "@latticexyz/common/chains";
+ import { MUDChain, latticeTestnet, mudFoundry } from "@latticexyz/common/chains";
- export const supportedChains: MUDChain[] = [foundry, latticeTestnet];
+ export const supportedChains: MUDChain[] = [mudFoundry, latticeTestnet];
In getNetworkConfig.ts
, remove the return type (to let TS infer it for now), remove now-unused config values, and add the viem chain
object.
- export async function getNetworkConfig(): Promise<NetworkConfig> {
+ export async function getNetworkConfig() {
const initialBlockNumber = params.has("initialBlockNumber")
? Number(params.get("initialBlockNumber"))
- : world?.blockNumber ?? -1; // -1 will attempt to find the block number from RPC
+ : world?.blockNumber ?? 0n;
+ return {
+ privateKey: getBurnerWallet().value,
+ chain,
+ worldAddress,
+ initialBlockNumber,
+ faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
+ };
In setupNetwork.ts
, replace setupMUDV2Network
with syncToRecs
.
- import { setupMUDV2Network } from "@latticexyz/std-client";
- import { createFastTxExecutor, createFaucetService, getSnapSyncRecords } from "@latticexyz/network";
+ import { createFaucetService } from "@latticexyz/network";
+ import { createPublicClient, fallback, webSocket, http, createWalletClient, getContract, Hex, parseEther, ClientConfig } from "viem";
+ import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
+ import { createBurnerAccount, createContract, transportObserver } from "@latticexyz/common";
- const result = await setupMUDV2Network({
- ...
- });
+ const clientOptions = {
+ chain: networkConfig.chain,
+ transport: transportObserver(fallback([webSocket(), http()])),
+ pollingInterval: 1000,
+ } as const satisfies ClientConfig;
+ const publicClient = createPublicClient(clientOptions);
+ const burnerAccount = createBurnerAccount(networkConfig.privateKey as Hex);
+ const burnerWalletClient = createWalletClient({
+ ...clientOptions,
+ account: burnerAccount,
+ });
+ const { components, latestBlock$, blockStorageOperations$, waitForTransaction } = await syncToRecs({
+ world,
+ config: storeConfig,
+ address: networkConfig.worldAddress as Hex,
+ publicClient,
+ components: contractComponents,
+ startBlock: BigInt(networkConfig.initialBlockNumber),
+ indexerUrl: networkConfig.indexerUrl ?? undefined,
+ });
+ const worldContract = createContract({
+ address: networkConfig.worldAddress as Hex,
+ abi: IWorld__factory.abi,
+ publicClient,
+ walletClient: burnerWalletClient,
+ });
// Request drip from faucet
- const signer = result.network.signer.get();
- if (networkConfig.faucetServiceUrl && signer) {
- const address = await signer.getAddress();
+ if (networkConfig.faucetServiceUrl) {
+ const address = burnerAccount.address;
const requestDrip = async () => {
- const balance = await signer.getBalance();
+ const balance = await publicClient.getBalance({ address });
console.info(`[Dev Faucet]: Player balance -> ${balance}`);
- const lowBalance = balance?.lte(utils.parseEther("1"));
+ const lowBalance = balance < parseEther("1");
You can remove the previous ethers worldContract
, snap sync code, and fast transaction executor.
The return of setupNetwork
is a bit different than before, so you may have to do corresponding app changes.
+ return {
+ world,
+ components,
+ playerEntity: encodeEntity({ address: "address" }, { address: burnerWalletClient.account.address }),
+ publicClient,
+ walletClient: burnerWalletClient,
+ latestBlock$,
+ blockStorageOperations$,
+ waitForTransaction,
+ worldContract,
+ };
Update createSystemCalls
with the new return type of setupNetwork
.
export function createSystemCalls(
- { worldSend, txReduced$, singletonEntity }: SetupNetworkResult,
+ { worldContract, waitForTransaction }: SetupNetworkResult,
{ Counter }: ClientComponents
) {
const increment = async () => {
- const tx = await worldSend("increment", []);
- await awaitStreamValue(txReduced$, (txHash) => txHash === tx.hash);
+ const tx = await worldContract.write.increment();
+ await waitForTransaction(tx);
return getComponentValue(Counter, singletonEntity);
};
(optional) If you still need a clock, you can create it with:
import { map, filter } from "rxjs";
import { createClock } from "@latticexyz/network";
const clock = createClock({
period: 1000,
initialTime: 0,
syncInterval: 5000,
});
world.registerDisposer(() => clock.dispose());
latestBlock$
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
If you're using the previous LoadingState
component, you'll want to migrate to the new SyncProgress
:
import { SyncStep, singletonEntity } from "@latticexyz/store-sync/recs";
const syncProgress = useComponentValue(SyncProgress, singletonEntity, {
message: "Connecting",
percentage: 0,
step: SyncStep.INITIALIZE,
});
if (syncProgress.step === SyncStep.LIVE) {
// we're live!
}
Published by github-actions[bot] about 1 year ago
3fb9ce28
, 35c9f33d
, b02f9d0e
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
#1214 60cfd089
Thanks @holic! - Templates and examples now use MUD's new sync packages, all built on top of viem. This greatly speeds up and stabilizes our networking code and improves types throughout.
These new sync packages come with support for our recs
package, including encodeEntity
and decodeEntity
utilities for composite keys.
If you're using store-cache
and useRow
/useRows
, you should wait to upgrade until we have a suitable replacement for those libraries. We're working on a sql.js-powered sync module that will replace store-cache
.
Migrate existing RECS apps to new sync packages
As you migrate, you may find some features replaced, removed, or not included by default. Please open an issue and let us know if we missed anything.
Add @latticexyz/store-sync
package to your app's client
package and make sure viem
is pinned to version 1.3.1
(otherwise you may get type errors)
In your supportedChains.ts
, replace foundry
chain with our new mudFoundry
chain.
- import { foundry } from "viem/chains";
- import { MUDChain, latticeTestnet } from "@latticexyz/common/chains";
+ import { MUDChain, latticeTestnet, mudFoundry } from "@latticexyz/common/chains";
- export const supportedChains: MUDChain[] = [foundry, latticeTestnet];
+ export const supportedChains: MUDChain[] = [mudFoundry, latticeTestnet];
In getNetworkConfig.ts
, remove the return type (to let TS infer it for now), remove now-unused config values, and add the viem chain
object.
- export async function getNetworkConfig(): Promise<NetworkConfig> {
+ export async function getNetworkConfig() {
const initialBlockNumber = params.has("initialBlockNumber")
? Number(params.get("initialBlockNumber"))
- : world?.blockNumber ?? -1; // -1 will attempt to find the block number from RPC
+ : world?.blockNumber ?? 0n;
+ return {
+ privateKey: getBurnerWallet().value,
+ chain,
+ worldAddress,
+ initialBlockNumber,
+ faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
+ };
In setupNetwork.ts
, replace setupMUDV2Network
with syncToRecs
.
- import { setupMUDV2Network } from "@latticexyz/std-client";
- import { createFastTxExecutor, createFaucetService, getSnapSyncRecords } from "@latticexyz/network";
+ import { createFaucetService } from "@latticexyz/network";
+ import { createPublicClient, fallback, webSocket, http, createWalletClient, getContract, Hex, parseEther, ClientConfig } from "viem";
+ import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
+ import { createBurnerAccount, createContract, transportObserver } from "@latticexyz/common";
- const result = await setupMUDV2Network({
- ...
- });
+ const clientOptions = {
+ chain: networkConfig.chain,
+ transport: transportObserver(fallback([webSocket(), http()])),
+ pollingInterval: 1000,
+ } as const satisfies ClientConfig;
+ const publicClient = createPublicClient(clientOptions);
+ const burnerAccount = createBurnerAccount(networkConfig.privateKey as Hex);
+ const burnerWalletClient = createWalletClient({
+ ...clientOptions,
+ account: burnerAccount,
+ });
+ const { components, latestBlock$, blockStorageOperations$, waitForTransaction } = await syncToRecs({
+ world,
+ config: storeConfig,
+ address: networkConfig.worldAddress as Hex,
+ publicClient,
+ components: contractComponents,
+ startBlock: BigInt(networkConfig.initialBlockNumber),
+ indexerUrl: networkConfig.indexerUrl ?? undefined,
+ });
+ const worldContract = createContract({
+ address: networkConfig.worldAddress as Hex,
+ abi: IWorld__factory.abi,
+ publicClient,
+ walletClient: burnerWalletClient,
+ });
// Request drip from faucet
- const signer = result.network.signer.get();
- if (networkConfig.faucetServiceUrl && signer) {
- const address = await signer.getAddress();
+ if (networkConfig.faucetServiceUrl) {
+ const address = burnerAccount.address;
const requestDrip = async () => {
- const balance = await signer.getBalance();
+ const balance = await publicClient.getBalance({ address });
console.info(`[Dev Faucet]: Player balance -> ${balance}`);
- const lowBalance = balance?.lte(utils.parseEther("1"));
+ const lowBalance = balance < parseEther("1");
You can remove the previous ethers worldContract
, snap sync code, and fast transaction executor.
The return of setupNetwork
is a bit different than before, so you may have to do corresponding app changes.
+ return {
+ world,
+ components,
+ playerEntity: encodeEntity({ address: "address" }, { address: burnerWalletClient.account.address }),
+ publicClient,
+ walletClient: burnerWalletClient,
+ latestBlock$,
+ blockStorageOperations$,
+ waitForTransaction,
+ worldContract,
+ };
Update createSystemCalls
with the new return type of setupNetwork
.
export function createSystemCalls(
- { worldSend, txReduced$, singletonEntity }: SetupNetworkResult,
+ { worldContract, waitForTransaction }: SetupNetworkResult,
{ Counter }: ClientComponents
) {
const increment = async () => {
- const tx = await worldSend("increment", []);
- await awaitStreamValue(txReduced$, (txHash) => txHash === tx.hash);
+ const tx = await worldContract.write.increment();
+ await waitForTransaction(tx);
return getComponentValue(Counter, singletonEntity);
};
(optional) If you still need a clock, you can create it with:
import { map, filter } from "rxjs";
import { createClock } from "@latticexyz/network";
const clock = createClock({
period: 1000,
initialTime: 0,
syncInterval: 5000,
});
world.registerDisposer(() => clock.dispose());
latestBlock$
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
If you're using the previous LoadingState
component, you'll want to migrate to the new SyncProgress
:
import { SyncStep, singletonEntity } from "@latticexyz/store-sync/recs";
const syncProgress = useComponentValue(SyncProgress, singletonEntity, {
message: "Connecting",
percentage: 0,
step: SyncStep.INITIALIZE,
});
if (syncProgress.step === SyncStep.LIVE) {
// we're live!
}
#1258 6c673325
Thanks @holic! - Add tableIdToHex
and hexToTableId
pure functions and move/deprecate TableId
.
#1261 cd5abcc3
Thanks @holic! - Add utils for using viem with MUD
createContract
is a wrapper around viem's getContract
but with better nonce handling for faster executing of transactions. It has the same arguments and return type as getContract
.createNonceManager
helps track local nonces, used by createContract
.Also renames mudTransportObserver
to transportObserver
.
#1245 3fb9ce28
Thanks @holic! - Add utils for using viem with MUD
mudFoundry
chain with a transaction request formatter that temporarily removes max fees to work better with anvil --base-fee 0
createBurnerAccount
that also temporarily removes max fees during transaction signing to work better with anvil --base-fee 0
mudTransportObserver
that will soon let MUD Dev Tools observe transactionsYou can use them like:
import { createBurnerAccount, mudTransportObserver } from "@latticexyz/common";
import { mudFoundry } from "@latticexyz/common/chains";
createWalletClient({
account: createBurnerAccount(privateKey),
chain: mudFoundry,
transport: mudTransportObserver(http()),
pollingInterval: 1000,
});
#1266 6071163f
Thanks @holic! - - Moves zero gas fee override to createContract
until https://github.com/wagmi-dev/viem/pull/963 or similar feature lands
gas
is provided#1271 35c9f33d
Thanks @holic! - - Remove need for tx queue in createContract
#1210 cc2c8da0
Thanks @dk1a! - - Refactor tightcoder to use typescript functions instead of ejs
TightCoder
libraryisLeftAligned
and getLeftPaddingBits
common codegen helpersUpdated dependencies [b02f9d0e
]:
Published by github-actions[bot] about 1 year ago
#1178 168a4cb4
Thanks @TheGreatAxios! - Add support for legacy transactions in deploy script by falling back to gasPrice
if lastBaseFeePerGas
is not available
#1206 e259ef79
Thanks @holic! - Generated contractComponents
now properly import World
as type
#1214 60cfd089
Thanks @holic! - Templates and examples now use MUD's new sync packages, all built on top of viem. This greatly speeds up and stabilizes our networking code and improves types throughout.
These new sync packages come with support for our recs
package, including encodeEntity
and decodeEntity
utilities for composite keys.
If you're using store-cache
and useRow
/useRows
, you should wait to upgrade until we have a suitable replacement for those libraries. We're working on a sql.js-powered sync module that will replace store-cache
.
Migrate existing RECS apps to new sync packages
As you migrate, you may find some features replaced, removed, or not included by default. Please open an issue and let us know if we missed anything.
Add @latticexyz/store-sync
package to your app's client
package and make sure viem
is pinned to version 1.3.1
(otherwise you may get type errors)
In your supportedChains.ts
, replace foundry
chain with our new mudFoundry
chain.
- import { foundry } from "viem/chains";
- import { MUDChain, latticeTestnet } from "@latticexyz/common/chains";
+ import { MUDChain, latticeTestnet, mudFoundry } from "@latticexyz/common/chains";
- export const supportedChains: MUDChain[] = [foundry, latticeTestnet];
+ export const supportedChains: MUDChain[] = [mudFoundry, latticeTestnet];
In getNetworkConfig.ts
, remove the return type (to let TS infer it for now), remove now-unused config values, and add the viem chain
object.
- export async function getNetworkConfig(): Promise<NetworkConfig> {
+ export async function getNetworkConfig() {
const initialBlockNumber = params.has("initialBlockNumber")
? Number(params.get("initialBlockNumber"))
- : world?.blockNumber ?? -1; // -1 will attempt to find the block number from RPC
+ : world?.blockNumber ?? 0n;
+ return {
+ privateKey: getBurnerWallet().value,
+ chain,
+ worldAddress,
+ initialBlockNumber,
+ faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
+ };
In setupNetwork.ts
, replace setupMUDV2Network
with syncToRecs
.
- import { setupMUDV2Network } from "@latticexyz/std-client";
- import { createFastTxExecutor, createFaucetService, getSnapSyncRecords } from "@latticexyz/network";
+ import { createFaucetService } from "@latticexyz/network";
+ import { createPublicClient, fallback, webSocket, http, createWalletClient, getContract, Hex, parseEther, ClientConfig } from "viem";
+ import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
+ import { createBurnerAccount, createContract, transportObserver } from "@latticexyz/common";
- const result = await setupMUDV2Network({
- ...
- });
+ const clientOptions = {
+ chain: networkConfig.chain,
+ transport: transportObserver(fallback([webSocket(), http()])),
+ pollingInterval: 1000,
+ } as const satisfies ClientConfig;
+ const publicClient = createPublicClient(clientOptions);
+ const burnerAccount = createBurnerAccount(networkConfig.privateKey as Hex);
+ const burnerWalletClient = createWalletClient({
+ ...clientOptions,
+ account: burnerAccount,
+ });
+ const { components, latestBlock$, blockStorageOperations$, waitForTransaction } = await syncToRecs({
+ world,
+ config: storeConfig,
+ address: networkConfig.worldAddress as Hex,
+ publicClient,
+ components: contractComponents,
+ startBlock: BigInt(networkConfig.initialBlockNumber),
+ indexerUrl: networkConfig.indexerUrl ?? undefined,
+ });
+ const worldContract = createContract({
+ address: networkConfig.worldAddress as Hex,
+ abi: IWorld__factory.abi,
+ publicClient,
+ walletClient: burnerWalletClient,
+ });
// Request drip from faucet
- const signer = result.network.signer.get();
- if (networkConfig.faucetServiceUrl && signer) {
- const address = await signer.getAddress();
+ if (networkConfig.faucetServiceUrl) {
+ const address = burnerAccount.address;
const requestDrip = async () => {
- const balance = await signer.getBalance();
+ const balance = await publicClient.getBalance({ address });
console.info(`[Dev Faucet]: Player balance -> ${balance}`);
- const lowBalance = balance?.lte(utils.parseEther("1"));
+ const lowBalance = balance < parseEther("1");
You can remove the previous ethers worldContract
, snap sync code, and fast transaction executor.
The return of setupNetwork
is a bit different than before, so you may have to do corresponding app changes.
+ return {
+ world,
+ components,
+ playerEntity: encodeEntity({ address: "address" }, { address: burnerWalletClient.account.address }),
+ publicClient,
+ walletClient: burnerWalletClient,
+ latestBlock$,
+ blockStorageOperations$,
+ waitForTransaction,
+ worldContract,
+ };
Update createSystemCalls
with the new return type of setupNetwork
.
export function createSystemCalls(
- { worldSend, txReduced$, singletonEntity }: SetupNetworkResult,
+ { worldContract, waitForTransaction }: SetupNetworkResult,
{ Counter }: ClientComponents
) {
const increment = async () => {
- const tx = await worldSend("increment", []);
- await awaitStreamValue(txReduced$, (txHash) => txHash === tx.hash);
+ const tx = await worldContract.write.increment();
+ await waitForTransaction(tx);
return getComponentValue(Counter, singletonEntity);
};
(optional) If you still need a clock, you can create it with:
import { map, filter } from "rxjs";
import { createClock } from "@latticexyz/network";
const clock = createClock({
period: 1000,
initialTime: 0,
syncInterval: 5000,
});
world.registerDisposer(() => clock.dispose());
latestBlock$
.pipe(
map((block) => Number(block.timestamp) * 1000), // Map to timestamp in ms
filter((blockTimestamp) => blockTimestamp !== clock.lastUpdateTime), // Ignore if the clock was already refreshed with this block
filter((blockTimestamp) => blockTimestamp !== clock.currentTime) // Ignore if the current local timestamp is correct
)
.subscribe(clock.update); // Update the local clock
If you're using the previous LoadingState
component, you'll want to migrate to the new SyncProgress
:
import { SyncStep, singletonEntity } from "@latticexyz/store-sync/recs";
const syncProgress = useComponentValue(SyncProgress, singletonEntity, {
message: "Connecting",
percentage: 0,
step: SyncStep.INITIALIZE,
});
if (syncProgress.step === SyncStep.LIVE) {
// we're live!
}
#1258 6c673325
Thanks @holic! - Add tableIdToHex
and hexToTableId
pure functions and move/deprecate TableId
.
#1195 afdba793
Thanks @holic! - Update RECS components with v2 key/value schemas. This helps with encoding/decoding composite keys and strong types for keys/values.
This may break if you were previously dependent on component.id
, component.metadata.componentId
, or component.metadata.tableId
:
component.id
is now the on-chain bytes32
hex representation of the table IDcomponent.metadata.componentName
is the table name (e.g. Position
)component.metadata.tableName
is the namespaced table name (e.g. myworld:Position
)component.metadata.keySchema
is an object with key names and their corresponding ABI typescomponent.metadata.valueSchema
is an object with field names and their corresponding ABI typesUpdated dependencies [3236f799
, c963b46c
, 3fb9ce28
, 35c9f33d
, 5c965a91
, b02f9d0e
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, cc2c8da0
]:
Published by github-actions[bot] about 1 year ago
3fb9ce28
, 35c9f33d
, b02f9d0e
, 60cfd089
, 6071163f
, 6c673325
, cd5abcc3
, cc2c8da0
]:
Published by github-actions[bot] over 1 year ago
#1061 a7b30c79
Thanks @dk1a! - Rename MudV2Test
to MudTest
and move from @latticexyz/std-contracts
to @latticexyz/store
.
// old import
import { MudV2Test } from "@latticexyz/std-contracts/src/test/MudV2Test.t.sol";
// new import
import { MudTest } from "@latticexyz/store/src/MudTest.sol";
Refactor StoreSwitch
to use a storage slot instead of function isStore()
to determine which contract is Store:
StoreSwitch
called isStore()
on msg.sender
to determine if msg.sender
is a Store
contract. If the call succeeded, the Store
methods were called on msg.sender
, otherwise the data was written to the own storage.StoreSwitch
instead checks for an address
in a known storage slot. If the address equals the own address, data is written to the own storage. If it is an external address, Store
methods are called on this address. If it is unset (address(0)
), store methods are called on msg.sender
.World
contracts sets its own address in StoreSwitch
, while System
contracts keep the Store address undefined, so Systems
write to their caller (World
) if they are executed via call
or directly to the World
storage if they are executed via delegatecall
.Systems
to explicitly set a Store
address to make them exclusive to that Store
andStore
argument, because the MudTest
base contract redirects reads and writes to the internal World
contract.#1153 8d51a034
Thanks @dk1a! - Clean up Memory.sol, make mcopy pure
#1168 48909d15
Thanks @dk1a! - bump forge-std and ds-test dependencies
#1165 4e4a3415
Thanks @holic! - bump to latest TS version (5.1.6)
Updated dependencies [904fd7d4
, 8d51a034
, 48909d15
, 66cc35a8
, f03531d9
, a7b30c79
, 53522998
, 0c4f9fea
]:
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
world/IWorld
to world/IBaseWorld
(#545) (38b355c)mud deploy
CLI command. Use mud deploy-contracts
instead.Published by github-actions[bot] over 1 year ago
#1165 4e4a3415
Thanks @holic! - bump to latest TS version (5.1.6)
Updated dependencies [8d51a034
, 53522998
, 0c4f9fea
]:
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
Note: Version bump only for package @latticexyz/utils
Note: Version bump only for package @latticexyz/utils
Note: Version bump only for package @latticexyz/utils
Note: Version bump only for package @latticexyz/utils
Published by github-actions[bot] over 1 year ago
#1176 eeb15cc0
Thanks @holic! - - Replace blockEventsToStorage
with blockLogsToStorage
that exposes a storeOperations
callback to perform database writes from store operations. This helps encapsulates database adapters into a single wrapper/instance of blockLogsToStorage
and allows for wrapping a block of store operations in a database transaction.
toBlock
option to groupLogsByBlockNumber
and remove blockHash
from results. This helps track the last block number for a given set of logs when used in the context of RxJS streams.#1185 69a96f10
Thanks @holic! - blockLogsToStorage(sqliteStorage(...))
converts block logs to SQLite operations. You can use it like:
import { drizzle } from "drizzle-orm/better-sqlite3";
import Database from "better-sqlite3";
import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core";
import { createPublicClient } from "viem";
import { blockLogsToStorage } from "@latticexyz/store-sync";
import { sqliteStorage } from "@latticexyz/store-sync/sqlite";
const database = drizzle(new Database('store.db')) as any as BaseSQLiteDatabase<"sync", void>;
const publicClient = createPublicClient({ ... });
blockLogs$
.pipe(
concatMap(blockLogsToStorage(sqliteStorage({ database, publicClient }))),
tap(({ blockNumber, operations }) => {
console.log("stored", operations.length, "operations for block", blockNumber);
})
)
.subscribe();
53522998
Thanks @holic! - - bump to viem 1.3.0 and abitype 0.9.3
@wagmi/chains
imports to viem/chains
904fd7d4
, b98e5180
, 4bb7e8cb
, ca50fef8
, eeb15cc0
, 72b80697
, 8d51a034
, 48909d15
, 66cc35a8
, f03531d9
, a7b30c79
, 53522998
, 0c4f9fea
]:
Published by github-actions[bot] over 1 year ago
53522998
Thanks @holic! - - bump to viem 1.3.0 and abitype 0.9.3
@wagmi/chains
imports to viem/chains
904fd7d4
, 8d51a034
, 48909d15
, 66cc35a8
, f03531d9
, a7b30c79
, 53522998
, 0c4f9fea
]:
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
Published by github-actions[bot] over 1 year ago
#1147 66cc35a8
Thanks @dk1a! - Create gas-report package, move gas-report cli command and GasReporter contract to it
#1061 a7b30c79
Thanks @dk1a! - Rename MudV2Test
to MudTest
and move from @latticexyz/std-contracts
to @latticexyz/store
.
// old import
import { MudV2Test } from "@latticexyz/std-contracts/src/test/MudV2Test.t.sol";
// new import
import { MudTest } from "@latticexyz/store/src/MudTest.sol";
Refactor StoreSwitch
to use a storage slot instead of function isStore()
to determine which contract is Store:
StoreSwitch
called isStore()
on msg.sender
to determine if msg.sender
is a Store
contract. If the call succeeded, the Store
methods were called on msg.sender
, otherwise the data was written to the own storage.StoreSwitch
instead checks for an address
in a known storage slot. If the address equals the own address, data is written to the own storage. If it is an external address, Store
methods are called on this address. If it is unset (address(0)
), store methods are called on msg.sender
.World
contracts sets its own address in StoreSwitch
, while System
contracts keep the Store address undefined, so Systems
write to their caller (World
) if they are executed via call
or directly to the World
storage if they are executed via delegatecall
.Systems
to explicitly set a Store
address to make them exclusive to that Store
andStore
argument, because the MudTest
base contract redirects reads and writes to the internal World
contract.#1153 8d51a034
Thanks @dk1a! - Clean up Memory.sol, make mcopy pure
#1168 48909d15
Thanks @dk1a! - bump forge-std and ds-test dependencies
#1179 53522998
Thanks @holic! - - bump to viem 1.3.0 and abitype 0.9.3
@wagmi/chains
imports to viem/chains
Updated dependencies [8d51a034
, 48909d15
, 66cc35a8
, f03531d9
, 53522998
, 0c4f9fea
]:
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
mud deploy
CLI command. Use mud deploy-contracts
instead.Published by github-actions[bot] over 1 year ago
#1061 a7b30c79
Thanks @dk1a! - Rename MudV2Test
to MudTest
and move from @latticexyz/std-contracts
to @latticexyz/store
.
// old import
import { MudV2Test } from "@latticexyz/std-contracts/src/test/MudV2Test.t.sol";
// new import
import { MudTest } from "@latticexyz/store/src/MudTest.sol";
Refactor StoreSwitch
to use a storage slot instead of function isStore()
to determine which contract is Store:
StoreSwitch
called isStore()
on msg.sender
to determine if msg.sender
is a Store
contract. If the call succeeded, the Store
methods were called on msg.sender
, otherwise the data was written to the own storage.StoreSwitch
instead checks for an address
in a known storage slot. If the address equals the own address, data is written to the own storage. If it is an external address, Store
methods are called on this address. If it is unset (address(0)
), store methods are called on msg.sender
.World
contracts sets its own address in StoreSwitch
, while System
contracts keep the Store address undefined, so Systems
write to their caller (World
) if they are executed via call
or directly to the World
storage if they are executed via delegatecall
.Systems
to explicitly set a Store
address to make them exclusive to that Store
andStore
argument, because the MudTest
base contract redirects reads and writes to the internal World
contract.All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
Note: Version bump only for package @latticexyz/std-contracts
Note: Version bump only for package @latticexyz/std-contracts
Note: Version bump only for package @latticexyz/std-contracts
Note: Version bump only for package @latticexyz/std-contracts
Published by github-actions[bot] over 1 year ago
53522998
Thanks @holic! - - bump to viem 1.3.0 and abitype 0.9.3
@wagmi/chains
imports to viem/chains
904fd7d4
, 8d51a034
, 1e2ad78e
, 48909d15
, 66cc35a8
, a7b30c79
, 4e4a3415
, 53522998
, 0c4f9fea
, c36ffd13
, e019c776
]:
All notable changes to this project will be documented in this file.
See Conventional Commits for commit guidelines.
Note: Version bump only for package @latticexyz/std-client
Note: Version bump only for package @latticexyz/std-client
Note: Version bump only for package @latticexyz/std-client
Note: Version bump only for package @latticexyz/std-client