Skip to content

Commit 834d288

Browse files
committed
Merge remote-tracking branch 'origin/main' into holic/worldgen-system-abis
2 parents e174fdd + e583fc9 commit 834d288

File tree

17 files changed

+64
-32
lines changed

17 files changed

+64
-32
lines changed

.changeset/clean-worms-walk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/common": patch
3+
---
4+
5+
Updated all custom Viem actions to properly call other actions via `getAction` so they can be composed.

.changeset/real-waves-bathe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@latticexyz/create-mud": patch
2+
"create-mud": patch
33
---
44

5-
Added `@latticexyz/explorer` and `@latticexyz/store-indexer` to all MUD templates. Updated default `worlds.json` config and world address.
5+
New projects created with `pnpm create mud` now include the World Explorer and SQLite indexer running as additional services.

.changeset/swift-rabbits-appear.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"@latticexyz/explorer": minor
33
---
44

5-
Initial release of the @latticexyz/explorer package. Explorer is a standalone tool designed to explore and manage worlds. This initial release supports local worlds, with plans to extend support to any world in the future.
5+
Initial release of the `@latticexyz/explorer` package. World Explorer is a standalone tool designed to explore and manage worlds. This initial release supports local worlds, with plans to extend support to any world in the future.
66

7-
Read more on how to get started or contribute in the [Explorer README](https://github.com/latticexyz/mud/blob/main/packages/explorer/README.md).
7+
Read more on how to get started or contribute in the [World Explorer README](https://github.com/latticexyz/mud/blob/main/packages/explorer/README.md).

.github/workflows/changeset.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Changeset
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
changeset:
8+
name: Validate changeset
9+
runs-on: depot-ubuntu-22.04-16
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup
17+
uses: ./.github/actions/setup
18+
19+
- name: Changeset
20+
run: pnpm changeset status --since origin/main

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "turbo run build",
1515
"changelog:generate": "bun scripts/changelog.ts",
1616
"clean": "turbo run clean",
17-
"dev": "TSUP_SKIP_DTS=true turbo run dev --concurrency 100",
17+
"dev": "TSUP_SKIP_DTS=true turbo run dev --concurrency 100 --filter=!@latticexyz/explorer",
1818
"dist-tag-rm": "pnpm recursive exec -- sh -c 'npm dist-tag rm $(cat package.json | jq -r \".name\") $TAG || true'",
1919
"docs:generate:api": "bun scripts/render-api-docs.ts",
2020
"foundryup": "curl -L https://foundry.paradigm.xyz | bash && bash ~/.foundry/bin/foundryup",

packages/cli/src/deploy/getRecord.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function getRecord<table extends Table>({
3131
functionName: "getRecord",
3232
args: [table.tableId, getKeyTuple(table, key)],
3333
// TODO: remove cast once https://github.com/wevm/viem/issues/2125 is resolved
34+
// has something to do function overloads and TS having a hard time inferring which args to use
3435
})) as [Hex, Hex, Hex];
3536
const record = {
3637
...key,

packages/common/src/createFeeRef.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { EstimateFeesPerGasParameters, Client, EstimateFeesPerGasReturnType } from "viem";
22
import { estimateFeesPerGas } from "viem/actions";
3+
import { getAction } from "viem/utils";
34

45
export type CreateFeeRefOptions = {
56
client: Client;
@@ -17,7 +18,7 @@ export async function createFeeRef({ client, args, refreshInterval }: CreateFeeR
1718
const feeRef: FeeRef = { fees: {}, lastUpdatedTimestamp: 0 };
1819

1920
async function updateFees(): Promise<void> {
20-
const fees = await estimateFeesPerGas(client, args);
21+
const fees = await getAction(client, estimateFeesPerGas, "estimateFeesPerGas")(args);
2122
feeRef.fees = fees;
2223
feeRef.lastUpdatedTimestamp = Date.now();
2324
}

packages/common/src/createNonceManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { debug as parentDebug } from "./debug";
33
import { getNonceManagerId } from "./getNonceManagerId";
44
import { getTransactionCount } from "viem/actions";
55
import PQueue from "p-queue";
6+
import { getAction } from "viem/utils";
67

78
const debug = parentDebug.extend("createNonceManager");
89

@@ -66,7 +67,7 @@ export function createNonceManager({
6667

6768
async function resetNonce(): Promise<void> {
6869
ref.noncePromise ??= (async (): Promise<void> => {
69-
ref.nonce = await getTransactionCount(client, { address, blockTag });
70+
ref.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({ address, blockTag });
7071
ref.noncePromise = null;
7172
channel?.postMessage(JSON.stringify(ref.nonce));
7273
debug("reset nonce to", ref.nonce);

packages/common/src/getFeeRef.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { getChainId } from "viem/actions";
22
import { CreateFeeRefOptions, FeeRef, createFeeRef } from "./createFeeRef";
3+
import { getAction } from "viem/utils";
34

45
const feeRefs = new Map<number, FeeRef>();
56

67
export async function getFeeRef(opts: CreateFeeRefOptions): Promise<FeeRef> {
7-
const chainId = opts.args?.chain?.id ?? opts.client.chain?.id ?? (await getChainId(opts.client));
8+
const chainId =
9+
opts.args?.chain?.id ?? opts.client.chain?.id ?? (await getAction(opts.client, getChainId, "getChainId")({}));
810

911
const existingFeeRef = feeRefs.get(chainId);
1012
if (existingFeeRef) {

packages/common/src/getNonceManagerId.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BlockTag, Client, Hex, getAddress } from "viem";
22
import { getChainId } from "viem/actions";
3+
import { getAction } from "viem/utils";
34

45
export async function getNonceManagerId({
56
client,
@@ -11,6 +12,6 @@ export async function getNonceManagerId({
1112
blockTag: BlockTag;
1213
}): Promise<string> {
1314
// TODO: improve this so we don't have to call getChainId every time
14-
const chainId = client.chain?.id ?? (await getChainId(client));
15+
const chainId = client.chain?.id ?? (await getAction(client, getChainId, "getChainId")({}));
1516
return `mud:createNonceManager:${chainId}:${getAddress(address)}:${blockTag}`;
1617
}

0 commit comments

Comments
 (0)