From 1e7e26335d8a5e0bb9321aa4817e223c40ea62b3 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 12:20:03 +0100 Subject: [PATCH 01/32] feat(cli): fetch table specific logs --- .gitignore | 4 +- package.json | 2 +- packages/block-logs-stream/src/fetchLogs.ts | 74 ++++++++------ packages/cli/src/deploy/getResourceIds.ts | 44 +++------ packages/store/package.json | 2 + packages/store/ts/common.ts | 6 ++ packages/store/ts/debug.ts | 7 ++ packages/store/ts/exports/internal.ts | 2 + packages/store/ts/flattenStoreLogs.ts | 64 ++++++++++++ packages/store/ts/getStoreLogs.ts | 104 ++++++++++++++++++++ packages/store/ts/storeEventsAbi.ts | 3 + packages/store/ts/storeLog.ts | 5 + pnpm-lock.yaml | 76 ++++++++------ 13 files changed, 305 insertions(+), 88 deletions(-) create mode 100644 packages/store/ts/debug.ts create mode 100644 packages/store/ts/flattenStoreLogs.ts create mode 100644 packages/store/ts/getStoreLogs.ts create mode 100644 packages/store/ts/storeLog.ts diff --git a/.gitignore b/.gitignore index 92fad4b3ce..610cfff0db 100644 --- a/.gitignore +++ b/.gitignore @@ -5,11 +5,11 @@ node_modules package-lock.json yarn.lock +*.log + .eslintcache .parcel-cache .docs -lerna-debug.log -yarn-error.log .turbo .attest .tstrace diff --git a/package.json b/package.json index 3c2ad5b267..156774d5dd 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "turbo run build", "changelog:generate": "tsx scripts/changelog.ts", "clean": "turbo run clean", - "dev": "TSUP_SKIP_DTS=true turbo run dev --concurrency 100", + "dev": "TSUP_SKIP_DTS=true turbo run dev --concurrency 100 --filter !@latticexyz/explorer", "dist-tag-rm": "pnpm recursive exec -- sh -c 'npm dist-tag rm $(cat package.json | jq -r \".name\") $TAG || true'", "docs:generate:api": "tsx scripts/render-api-docs.ts", "fix:package-json": "sort-package-json package.json 'packages/*/package.json' 'templates/*/package.json' 'templates/*/packages/*/package.json' 'examples/*/package.json' 'examples/*/packages/*/package.json' 'e2e/*/package.json' 'e2e/*/packages/*/package.json' 'docs/package.json' 'test/*/package.json'", diff --git a/packages/block-logs-stream/src/fetchLogs.ts b/packages/block-logs-stream/src/fetchLogs.ts index a12a1a3574..f5b4da097d 100644 --- a/packages/block-logs-stream/src/fetchLogs.ts +++ b/packages/block-logs-stream/src/fetchLogs.ts @@ -1,25 +1,11 @@ import { AbiEvent } from "abitype"; -import { Address, Client, BlockNumber, GetLogsReturnType } from "viem"; +import { Address, Client, BlockNumber, GetLogsReturnType, OneOf } from "viem"; import { bigIntMin, wait } from "@latticexyz/common/utils"; import { debug } from "./debug"; import { getAction } from "viem/utils"; -import { getLogs } from "viem/actions"; +import { getLogs as viem_getLogs } from "viem/actions"; export type FetchLogsOptions = { - /** - * [viem `Client`][0] used for fetching logs from the RPC. - * - * [0]: https://viem.sh/docs/clients/public.html - */ - publicClient: Client; - /** - * Optional contract address(es) to fetch logs for. - */ - address?: Address | Address[]; - /** - * Events to fetch logs for. - */ - events: abiEvents; /** * The block number to start fetching logs from (inclusive). */ @@ -36,7 +22,33 @@ export type FetchLogsOptions = { * Optional maximum amount of retries if the RPC returns a rate limit error. Defaults to 3. */ maxRetryCount?: number; -}; +} & OneOf< + | { + /** + * Async function to return logs for the given block range. + */ + getLogs: (args: { + fromBlock: bigint; + toBlock: bigint; + }) => Promise>; + } + | { + /** + * [viem `Client`][0] used for fetching logs from the RPC. + * + * [0]: https://viem.sh/docs/clients/public.html + */ + publicClient: Client; + /** + * Optional contract address(es) to fetch logs for. + */ + address?: Address | Address[]; + /** + * Events to fetch logs for. + */ + events: abiEvents; + } +>; export type FetchLogsResult = { fromBlock: BlockNumber; @@ -96,25 +108,31 @@ const BLOCK_RANGE_ERRORS = [ export async function* fetchLogs({ maxBlockRange = 1000n, maxRetryCount = 3, - publicClient, - ...getLogsOpts + fromBlock: initialFromBlock, + toBlock: initialToBlock, + ...opts }: FetchLogsOptions): AsyncGenerator> { - let fromBlock = getLogsOpts.fromBlock; - let blockRange = bigIntMin(maxBlockRange, getLogsOpts.toBlock - fromBlock); + const getLogs = + opts.getLogs ?? + (async (blockRange): Promise> => + getAction( + opts.publicClient, + viem_getLogs, + "getLogs", + )({ ...blockRange, address: opts.address, events: opts.events, strict: true })); + + let fromBlock = initialFromBlock; + let blockRange = bigIntMin(maxBlockRange, initialToBlock - fromBlock); let retryCount = 0; - while (fromBlock <= getLogsOpts.toBlock) { + while (fromBlock <= initialToBlock) { try { const toBlock = fromBlock + blockRange; debug(`getting logs for blocks ${fromBlock}-${toBlock} (${blockRange} blocks, ${maxBlockRange} max)`); - const logs = await getAction( - publicClient, - getLogs, - "getLogs", - )({ ...getLogsOpts, fromBlock, toBlock, strict: true }); + const logs = await getLogs({ fromBlock, toBlock }); yield { fromBlock, toBlock, logs }; fromBlock = toBlock + 1n; - blockRange = bigIntMin(maxBlockRange, getLogsOpts.toBlock - fromBlock); + blockRange = bigIntMin(maxBlockRange, initialToBlock - fromBlock); retryCount = 0; } catch (error: unknown) { if (!(error instanceof Error)) throw error; diff --git a/packages/cli/src/deploy/getResourceIds.ts b/packages/cli/src/deploy/getResourceIds.ts index 4286d671b2..ab59fa840d 100644 --- a/packages/cli/src/deploy/getResourceIds.ts +++ b/packages/cli/src/deploy/getResourceIds.ts @@ -1,10 +1,9 @@ -import { Client, parseAbiItem, Hex, HttpRequestError } from "viem"; -import { getLogs } from "viem/actions"; -import { storeSpliceStaticDataEvent } from "@latticexyz/store"; +import { Client, Hex } from "viem"; +import { flattenStoreLogs, getStoreLogs } from "@latticexyz/store/internal"; import { WorldDeploy } from "./common"; import { debug } from "./debug"; -import pRetry from "p-retry"; import storeConfig from "@latticexyz/store/mud.config"; +import { fetchBlockLogs } from "@latticexyz/block-logs-stream"; export async function getResourceIds({ client, @@ -13,33 +12,22 @@ export async function getResourceIds({ readonly client: Client; readonly worldDeploy: WorldDeploy; }): Promise { - // This assumes we only use `ResourceIds._setExists(true)`, which is true as of this writing. - // TODO: PR to viem's getLogs to accept topics array so we can filter on all store events and quickly recreate this table's current state - debug("looking up resource IDs for", worldDeploy.address); - const logs = await pRetry( - () => - getLogs(client, { - strict: true, - address: worldDeploy.address, - fromBlock: worldDeploy.deployBlock, - toBlock: worldDeploy.stateBlock, - event: parseAbiItem(storeSpliceStaticDataEvent), - args: { tableId: storeConfig.namespaces.store.tables.ResourceIds.tableId }, - }), - { - retries: 3, - onFailedAttempt: async (error) => { - const shouldRetry = - error instanceof HttpRequestError && error.status === 400 && error.message.includes("block is out of range"); - if (!shouldRetry) { - throw error; - } - }, + const blockLogs = await fetchBlockLogs({ + fromBlock: worldDeploy.deployBlock, + toBlock: worldDeploy.stateBlock, + async getLogs({ fromBlock, toBlock }) { + return getStoreLogs(client, { + address: worldDeploy.address, + fromBlock, + toBlock, + tableId: storeConfig.namespaces.store.tables.ResourceIds.tableId, + }); }, - ); - const resourceIds = logs.map((log) => log.args.keyTuple[0]); + }); + + const resourceIds = flattenStoreLogs(blockLogs.flatMap((block) => block.logs)).map((log) => log.args.keyTuple[0]); debug("found", resourceIds.length, "resource IDs for", worldDeploy.address); return resourceIds; diff --git a/packages/store/package.json b/packages/store/package.json index f5fb1ade64..bdaba1cdea 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -66,11 +66,13 @@ "@latticexyz/schema-type": "workspace:*", "abitype": "catalog:", "arktype": "catalog:", + "debug": "^4.3.4", "viem": "catalog:" }, "devDependencies": { "@latticexyz/abi-ts": "workspace:*", "@latticexyz/gas-report": "workspace:*", + "@types/debug": "^4.1.7", "@types/ejs": "^3.1.1", "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", diff --git a/packages/store/ts/common.ts b/packages/store/ts/common.ts index 74f90e9ca5..4205c5d1d3 100644 --- a/packages/store/ts/common.ts +++ b/packages/store/ts/common.ts @@ -28,3 +28,9 @@ export type Tables = { export type SchemaToPrimitives = { readonly [key in keyof schema]: SchemaAbiTypeToPrimitiveType; }; + +export const emptyRecord = { + staticData: "0x", + encodedLengths: "0x", + dynamicData: "0x", +} as const; diff --git a/packages/store/ts/debug.ts b/packages/store/ts/debug.ts new file mode 100644 index 0000000000..46f225860a --- /dev/null +++ b/packages/store/ts/debug.ts @@ -0,0 +1,7 @@ +import createDebug from "debug"; + +export const debug = createDebug("mud:store"); +debug.log = console.debug.bind(console); + +export const error = createDebug("mud:store"); +error.log = console.error.bind(console); diff --git a/packages/store/ts/exports/internal.ts b/packages/store/ts/exports/internal.ts index 42b6909822..656d9b3a80 100644 --- a/packages/store/ts/exports/internal.ts +++ b/packages/store/ts/exports/internal.ts @@ -1 +1,3 @@ export * from "../common"; +export * from "../getStoreLogs"; +export * from "../flattenStoreLogs"; diff --git a/packages/store/ts/flattenStoreLogs.ts b/packages/store/ts/flattenStoreLogs.ts new file mode 100644 index 0000000000..67dee7b319 --- /dev/null +++ b/packages/store/ts/flattenStoreLogs.ts @@ -0,0 +1,64 @@ +import { Log, size } from "viem"; +import { storeEventsAbi } from "./storeEventsAbi"; +import { emptyRecord } from "./common"; +import { StoreLog, StoreSetRecordLog } from "./storeLog"; +import { spliceHex } from "@latticexyz/common"; + +function getKey(log: Log) { + return [log.address, log.args.tableId, log.args.keyTuple.join(",")].join(":"); +} + +export function flattenStoreLogs(logs: StoreLog[]): StoreSetRecordLog[] { + const records = new Map(); + + for (const log of logs) { + const key = getKey(log); + + if (log.eventName === "Store_SetRecord") { + // maps preserve order, so always delete then set so the record gets + // added to the end of the map, thus preserving the log order + records.delete(key); + records.set(key, log); + } else if (log.eventName === "Store_SpliceStaticData") { + const previousRecord = records.get(key); + const { staticData, encodedLengths, dynamicData } = previousRecord?.args ?? emptyRecord; + const nextRecord = { + ...log, + eventName: "Store_SetRecord", + args: { + tableId: log.args.tableId, + keyTuple: log.args.keyTuple, + staticData: spliceHex(staticData, log.args.start, size(log.args.data), log.args.data), + encodedLengths, + dynamicData, + }, + } satisfies StoreSetRecordLog; + // maps preserve order, so always delete then set so the record gets + // added to the end of the map, thus preserving the log order + records.delete(key); + records.set(key, nextRecord); + } else if (log.eventName === "Store_SpliceDynamicData") { + const previousRecord = records.get(key); + const { staticData, dynamicData } = previousRecord?.args ?? emptyRecord; + const nextRecord = { + ...log, + eventName: "Store_SetRecord", + args: { + tableId: log.args.tableId, + keyTuple: log.args.keyTuple, + staticData, + encodedLengths: log.args.encodedLengths, + dynamicData: spliceHex(dynamicData, log.args.start, log.args.deleteCount, log.args.data), + }, + } satisfies StoreSetRecordLog; + // maps preserve order, so always delete then set so the record gets + // added to the end of the map, thus preserving the log order + records.delete(key); + records.set(key, nextRecord); + } else if (log.eventName === "Store_DeleteRecord") { + records.delete(key); + } + } + + return Array.from(records.values()); +} diff --git a/packages/store/ts/getStoreLogs.ts b/packages/store/ts/getStoreLogs.ts new file mode 100644 index 0000000000..06b1e4e0c4 --- /dev/null +++ b/packages/store/ts/getStoreLogs.ts @@ -0,0 +1,104 @@ +import { + BlockNumber, + BlockTag, + Address, + Log, + Hex, + GetLogsErrorType, + Client, + toEventSelector, + LogTopic, + RpcLog, + numberToHex, + formatLog, + parseEventLogs, +} from "viem"; +import { storeEventsAbi } from "./storeEventsAbi"; +import { debug } from "./debug"; +import { hexToResource, resourceToLabel } from "@latticexyz/common"; + +export type GetStoreLogsParameters< + fromBlock extends BlockNumber | BlockTag | undefined = undefined, + toBlock extends BlockNumber | BlockTag | undefined = undefined, +> = { + /** Store address or list of store addresses from which logs originated */ + address?: Address | Address[] | undefined; + /** Optionally match a specific table ID or list of table IDs */ + tableId?: Hex | Hex[] | undefined; + /** Block number or tag after which to include logs */ + fromBlock?: fromBlock | BlockNumber | BlockTag | undefined; + /** Block number or tag before which to include logs */ + toBlock?: toBlock | BlockNumber | BlockTag | undefined; +}; + +export type GetStoreLogsReturnType< + fromBlock extends BlockNumber | BlockTag | undefined = undefined, + toBlock extends BlockNumber | BlockTag | undefined = undefined, + _pending extends boolean = (fromBlock extends "pending" ? true : false) | (toBlock extends "pending" ? true : false), +> = Log[]; + +export type GetStoreLogsErrorType = GetLogsErrorType; + +/** + * Returns a list of store event logs matching the provided parameters. + * + * @param client - Client to use + * @param parameters - {@link GetStoreLogsParameters} + * @returns A list of event logs. {@link GetStoreLogsReturnType} + * + * @example + * import { createClient, http } from 'viem' + * import { mainnet } from 'viem/chains' + * import { getStoreLogs } from '@latticexyz/store' + * + * const client = createPublicClient({ + * chain: mainnet, + * transport: http(), + * }) + * const storeLogs = await getStoreLogs(client) + */ +export async function getStoreLogs< + fromBlock extends BlockNumber | BlockTag | undefined = undefined, + toBlock extends BlockNumber | BlockTag | undefined = undefined, +>( + client: Client, + { address, tableId, fromBlock, toBlock }: GetStoreLogsParameters = {}, +): Promise> { + /** + * Note that this implementation follows Viem's [`getLogs`][0] action: + * https://github.com/wevm/viem/blob/main/src/actions/public/getLogs.ts + * + * It's adapted to allow filtering by table ID(s), which Viem's `getLogs` + * does not support due to how it builds topics. + */ + + const topics: LogTopic[] = [storeEventsAbi.map(toEventSelector), tableId ?? null]; + + const tableIds = tableId ? (Array.isArray(tableId) ? tableId : [tableId]) : []; + const addresses = address ? (Array.isArray(address) ? address : [address]) : []; + debug( + `getting store logs for ${ + tableIds.length ? tableIds.map(hexToResource).map(resourceToLabel).join(", ") : "all tables" + } at ${addresses.length ? addresses.join(", ") : "any address"}`, + ); + + const logs: RpcLog[] = await client.request({ + method: "eth_getLogs", + params: [ + { + address, + topics, + fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock, + toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock, + }, + ], + }); + + const formattedLogs = logs.map((log) => formatLog(log)); + return parseEventLogs({ + abi: storeEventsAbi, + args: { tableId }, + logs: formattedLogs, + strict: true, + }) as GetStoreLogsReturnType; +} diff --git a/packages/store/ts/storeEventsAbi.ts b/packages/store/ts/storeEventsAbi.ts index d15b0b3c67..dbe26f3bac 100644 --- a/packages/store/ts/storeEventsAbi.ts +++ b/packages/store/ts/storeEventsAbi.ts @@ -2,6 +2,9 @@ import { parseAbi, AbiEvent } from "abitype"; import { storeEvents } from "./storeEvents"; export const storeEventsAbi = parseAbi(storeEvents) satisfies readonly AbiEvent[]; +export type storeEventsAbi = typeof storeEventsAbi; export type StoreEventsAbi = typeof storeEventsAbi; export type StoreEventsAbiItem = (typeof storeEventsAbi)[number]; + +export type StoreSetRecordEventAbiItem = StoreEventsAbiItem & { readonly name: "Store_SetRecord" }; diff --git a/packages/store/ts/storeLog.ts b/packages/store/ts/storeLog.ts new file mode 100644 index 0000000000..d97a3c59ec --- /dev/null +++ b/packages/store/ts/storeLog.ts @@ -0,0 +1,5 @@ +import { Log } from "viem"; +import { StoreEventsAbiItem, StoreEventsAbi, StoreSetRecordEventAbiItem } from "./storeEventsAbi"; + +export type StoreLog = Log; +export type StoreSetRecordLog = Log; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 571ea0d785..fdd0282240 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,9 +6,21 @@ settings: catalogs: default: + '@ark/attest': + specifier: 0.12.1 + version: 0.12.1 + '@ark/util': + specifier: 0.2.2 + version: 0.2.2 '@wagmi/core': specifier: 2.13.5 version: 2.13.5 + abitype: + specifier: 1.0.6 + version: 1.0.6 + arktype: + specifier: 2.0.0-beta.6 + version: 2.0.0-beta.6 viem: specifier: 2.21.6 version: 2.21.6 @@ -107,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -135,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/cli: dependencies: @@ -277,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/common: dependencies: @@ -329,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/config: dependencies: @@ -443,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/explorer: dependencies: @@ -658,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/gas-report: dependencies: @@ -704,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/protocol-parser: dependencies: @@ -729,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/react: dependencies: @@ -781,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/recs: dependencies: @@ -840,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -905,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store: dependencies: @@ -930,6 +942,9 @@ importers: arktype: specifier: 'catalog:' version: 2.0.0-beta.6 + debug: + specifier: ^4.3.4 + version: 4.3.7 viem: specifier: 'catalog:' version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) @@ -940,6 +955,9 @@ importers: '@latticexyz/gas-report': specifier: workspace:* version: link:../gas-report + '@types/debug': + specifier: ^4.1.7 + version: 4.1.7 '@types/ejs': specifier: ^3.1.1 version: 3.1.1 @@ -966,7 +984,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-indexer: dependencies: @@ -1081,7 +1099,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-sync: dependencies: @@ -1178,7 +1196,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/utils: dependencies: @@ -1279,7 +1297,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1319,7 +1337,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-modules: dependencies: @@ -1380,7 +1398,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -12865,7 +12883,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.25.3 '@babel/types': 7.25.2 - debug: 4.3.4 + debug: 4.3.7 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -13766,7 +13784,7 @@ snapshots: '@koa/router@12.0.1': dependencies: - debug: 4.3.4 + debug: 4.3.7 http-errors: 2.0.0 koa-compose: 4.1.0 methods: 1.1.2 @@ -16115,7 +16133,7 @@ snapshots: '@typescript-eslint/type-utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) '@typescript-eslint/utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) '@typescript-eslint/visitor-keys': 7.1.1 - debug: 4.3.4 + debug: 4.3.7 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -16133,7 +16151,7 @@ snapshots: '@typescript-eslint/types': 7.1.1 '@typescript-eslint/typescript-estree': 7.1.1(typescript@5.4.2) '@typescript-eslint/visitor-keys': 7.1.1 - debug: 4.3.4 + debug: 4.3.7 eslint: 8.57.0 optionalDependencies: typescript: 5.4.2 @@ -16149,7 +16167,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 7.1.1(typescript@5.4.2) '@typescript-eslint/utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) - debug: 4.3.4 + debug: 4.3.7 eslint: 8.57.0 ts-api-utils: 1.2.1(typescript@5.4.2) optionalDependencies: @@ -16163,7 +16181,7 @@ snapshots: dependencies: '@typescript-eslint/types': 7.1.1 '@typescript-eslint/visitor-keys': 7.1.1 - debug: 4.3.4 + debug: 4.3.7 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -16996,7 +17014,7 @@ snapshots: avvio@8.2.1: dependencies: archy: 1.0.0 - debug: 4.3.4 + debug: 4.3.7 fastq: 1.15.0 transitivePeerDependencies: - supports-color @@ -18323,7 +18341,7 @@ snapshots: eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0): dependencies: - debug: 4.3.4 + debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.0 eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) @@ -20300,7 +20318,7 @@ snapshots: content-disposition: 0.5.4 content-type: 1.0.5 cookies: 0.8.0 - debug: 4.3.4 + debug: 4.3.7 delegates: 1.0.0 depd: 2.0.0 destroy: 1.2.0 @@ -22986,7 +23004,7 @@ snapshots: bundle-require: 4.0.1(esbuild@0.17.17) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.7 esbuild: 0.17.17 execa: 5.1.1 globby: 11.1.0 @@ -23009,7 +23027,7 @@ snapshots: bundle-require: 4.0.1(esbuild@0.17.17) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.7 esbuild: 0.17.17 execa: 5.1.1 globby: 11.1.0 @@ -23357,7 +23375,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 From 6c98d173d1fa134d4b926a4ce1394bb64c1f8a3b Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 13:46:55 +0100 Subject: [PATCH 02/32] pass through opts from blockRangeToLogs --- .../block-logs-stream/src/blockRangeToLogs.ts | 48 ++++--------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/packages/block-logs-stream/src/blockRangeToLogs.ts b/packages/block-logs-stream/src/blockRangeToLogs.ts index 76084db60a..39c7866fb8 100644 --- a/packages/block-logs-stream/src/blockRangeToLogs.ts +++ b/packages/block-logs-stream/src/blockRangeToLogs.ts @@ -1,29 +1,13 @@ import { EMPTY, OperatorFunction, concatMap, from, pipe, tap } from "rxjs"; -import { FetchLogsResult, fetchLogs } from "./fetchLogs"; +import { FetchLogsOptions, FetchLogsResult, fetchLogs } from "./fetchLogs"; import { AbiEvent } from "abitype"; -import { Address, BlockNumber, Client } from "viem"; +import { BlockNumber, UnionOmit } from "viem"; import { debug } from "./debug"; -export type BlockRangeToLogsOptions = { - /** - * [viem `Client`][0] used for fetching logs from the RPC. - * - * [0]: https://viem.sh/docs/clients/public.html - */ - publicClient: Client; - /** - * Optional contract address(es) to fetch logs for. - */ - address?: Address | Address[]; - /** - * Events to fetch logs for. - */ - events: abiEvents; - /** - * Optional maximum block range, if your RPC limits the amount of blocks fetched at a time. - */ - maxBlockRange?: bigint; -}; +export type BlockRangeToLogsOptions = UnionOmit< + FetchLogsOptions, + "fromBlock" | "toBlock" +>; export type BlockRangeToLogsResult = OperatorFunction< { startBlock: BlockNumber; endBlock: BlockNumber }, @@ -38,12 +22,9 @@ export type BlockRangeToLogsResult = Oper * @param {BlockRangeToLogsOptions} options See `BlockRangeToLogsOptions`. * @returns {BlockRangeToLogsResult} An operator function that transforms a stream of block ranges into a stream of fetched logs. */ -export function blockRangeToLogs({ - publicClient, - address, - events, - maxBlockRange, -}: BlockRangeToLogsOptions): BlockRangeToLogsResult { +export function blockRangeToLogs( + opts: BlockRangeToLogsOptions, +): BlockRangeToLogsResult { let fromBlock: bigint; let toBlock: bigint; @@ -57,16 +38,7 @@ export function blockRangeToLogs({ concatMap(() => { if (fromBlock > toBlock) return EMPTY; debug(`fetching logs for block range ${fromBlock}-${toBlock}`); - return from( - fetchLogs({ - publicClient, - address, - events, - fromBlock, - toBlock, - maxBlockRange, - }), - ).pipe( + return from(fetchLogs({ ...opts, fromBlock, toBlock })).pipe( tap(({ toBlock }) => { fromBlock = toBlock + 1n; }), From 0eb32e4de373442eb64f757c622b96c3da13edb2 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 13:47:48 +0100 Subject: [PATCH 03/32] update type --- packages/store-sync/src/fetchAndStoreLogs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/store-sync/src/fetchAndStoreLogs.ts b/packages/store-sync/src/fetchAndStoreLogs.ts index 76a5f734e5..6c7a826ed6 100644 --- a/packages/store-sync/src/fetchAndStoreLogs.ts +++ b/packages/store-sync/src/fetchAndStoreLogs.ts @@ -12,7 +12,7 @@ export async function* fetchAndStoreLogs({ logFilter, ...fetchLogsOptions }: FetchAndStoreLogsOptions): AsyncGenerator { - for await (const { logs, toBlock } of fetchLogs(fetchLogsOptions)) { + for await (const { logs, toBlock } of fetchLogs(fetchLogsOptions)) { const blocks = groupLogsByBlockNumber(logFilter ? logs.filter(logFilter) : logs, toBlock); for (const block of blocks) { await storageAdapter(block); From 0b05c0c07d65ca71a5fd7428895617b88fbdaf35 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 14:48:45 +0100 Subject: [PATCH 04/32] add tests --- packages/common/src/index.ts | 1 + packages/common/src/logSort.ts | 16 + packages/store-sync/test/logsToBlocks.ts | 3 +- packages/store/package.json | 2 + packages/store/ts/flattenStoreLogs.test.ts | 180 ++++++++++++ packages/store/ts/getStoreLogs.test.ts | 323 +++++++++++++++++++++ packages/store/ts/getStoreLogs.ts | 2 +- packages/store/ts/test/common.ts | 16 + packages/store/ts/test/globalSetup.ts | 19 ++ packages/store/ts/test/mockGame.ts | 35 +++ packages/store/ts/test/setup.ts | 18 ++ packages/store/ts/test/summarizeLogs.ts | 12 + packages/store/vitest.config.ts | 13 +- pnpm-lock.yaml | 73 +++-- 14 files changed, 687 insertions(+), 26 deletions(-) create mode 100644 packages/common/src/logSort.ts create mode 100644 packages/store/ts/flattenStoreLogs.test.ts create mode 100644 packages/store/ts/getStoreLogs.test.ts create mode 100644 packages/store/ts/test/common.ts create mode 100644 packages/store/ts/test/globalSetup.ts create mode 100644 packages/store/ts/test/mockGame.ts create mode 100644 packages/store/ts/test/setup.ts create mode 100644 packages/store/ts/test/summarizeLogs.ts diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 51248832f4..00d17b5735 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -7,6 +7,7 @@ export * from "./getBurnerPrivateKey"; export * from "./getNonceManager"; export * from "./getNonceManagerId"; export * from "./hexToResource"; +export * from "./logSort"; export * from "./LruMap"; export * from "./readHex"; export * from "./resourceToLabel"; diff --git a/packages/common/src/logSort.ts b/packages/common/src/logSort.ts new file mode 100644 index 0000000000..f3e9da1439 --- /dev/null +++ b/packages/common/src/logSort.ts @@ -0,0 +1,16 @@ +import { Log } from "viem"; + +export function logSort(a: Log, b: Log): number { + if (a.blockNumber === b.blockNumber) { + if (a.logIndex === b.logIndex) return 0; + if (a.logIndex == null) return 1; + if (b.logIndex == null) return -1; + return a.logIndex - b.logIndex; + } + + if (a.blockNumber == null) return 1; + if (b.blockNumber == null) return -1; + if (a.blockNumber > b.blockNumber) return 1; + if (a.blockNumber < b.blockNumber) return -1; + return 0; +} diff --git a/packages/store-sync/test/logsToBlocks.ts b/packages/store-sync/test/logsToBlocks.ts index 2cfbcdf50e..d219bc87b9 100644 --- a/packages/store-sync/test/logsToBlocks.ts +++ b/packages/store-sync/test/logsToBlocks.ts @@ -14,8 +14,7 @@ export function logsToBlocks( topics: log.topics as [Hex, ...Hex[]], strict: true, }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return formatLog(log as any as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog; + return formatLog(log as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog; }), ); } diff --git a/packages/store/package.json b/packages/store/package.json index bdaba1cdea..4ec6d2777e 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -76,8 +76,10 @@ "@types/ejs": "^3.1.1", "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", + "@viem/anvil": "^0.0.7", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", + "mock-game-contracts": "workspace:*", "solhint": "^3.3.7", "tsup": "^6.7.0", "tsx": "^3.12.6", diff --git a/packages/store/ts/flattenStoreLogs.test.ts b/packages/store/ts/flattenStoreLogs.test.ts new file mode 100644 index 0000000000..5270224450 --- /dev/null +++ b/packages/store/ts/flattenStoreLogs.test.ts @@ -0,0 +1,180 @@ +/* eslint-disable max-len */ +import { beforeAll, describe, expect, it } from "vitest"; +import { deployMockGame } from "./test/mockGame"; +import { testClient } from "./test/common"; +import { getStoreLogs } from "./getStoreLogs"; +import { summarizeLogs } from "./test/summarizeLogs"; +import { flattenStoreLogs } from "./flattenStoreLogs"; + +describe("flattenStoreLogs", async () => { + beforeAll(async () => { + await deployMockGame(); + }); + + it("flattens store logs", async () => { + const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); + const flattenedLogs = flattenStoreLogs(logs); + + expect(summarizeLogs(flattenedLogs)).toMatchInlineSnapshot(` + [ + "Store_SetRecord world__InitModuleAddres ()", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", + "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", + "Store_SetRecord Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", + ] + `); + }); +}); diff --git a/packages/store/ts/getStoreLogs.test.ts b/packages/store/ts/getStoreLogs.test.ts new file mode 100644 index 0000000000..5292ac47f5 --- /dev/null +++ b/packages/store/ts/getStoreLogs.test.ts @@ -0,0 +1,323 @@ +/* eslint-disable max-len */ +import { beforeAll, describe, expect, it } from "vitest"; +import { deployMockGame } from "./test/mockGame"; +import { testClient } from "./test/common"; +import { getStoreLogs } from "./getStoreLogs"; +import config from "../mud.config"; +import { summarizeLogs } from "./test/summarizeLogs"; + +describe("getStoreLogs", async () => { + beforeAll(async () => { + await deployMockGame(); + }); + + it("fetches only store logs", async () => { + const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SpliceStaticData world__InitModuleAddres ()", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_DeleteRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SpliceStaticData world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_DeleteRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SpliceStaticData world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceDynamicData metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceDynamicData metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", + "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SpliceStaticData Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SpliceStaticData Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SpliceStaticData Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", + "Store_SpliceStaticData Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", + ] + `); + }); + + it("fetches only store logs for a specific table", async () => { + const logs = await getStoreLogs(testClient, { + fromBlock: "earliest", + toBlock: "latest", + tableId: config.tables.store__ResourceIds.tableId, + }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + ] + `); + }); + + it("fetches only store logs for specific tables", async () => { + const logs = await getStoreLogs(testClient, { + fromBlock: "earliest", + toBlock: "latest", + tableId: [config.tables.store__ResourceIds.tableId, config.tables.store__Tables.tableId], + }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + ] + `); + }); +}); diff --git a/packages/store/ts/getStoreLogs.ts b/packages/store/ts/getStoreLogs.ts index 06b1e4e0c4..16d3aeeb77 100644 --- a/packages/store/ts/getStoreLogs.ts +++ b/packages/store/ts/getStoreLogs.ts @@ -40,7 +40,7 @@ export type GetStoreLogsReturnType< export type GetStoreLogsErrorType = GetLogsErrorType; /** - * Returns a list of store event logs matching the provided parameters. + * Returns an unordered list of store event logs matching the provided parameters. * * @param client - Client to use * @param parameters - {@link GetStoreLogsParameters} diff --git a/packages/store/ts/test/common.ts b/packages/store/ts/test/common.ts new file mode 100644 index 0000000000..e0fe53774e --- /dev/null +++ b/packages/store/ts/test/common.ts @@ -0,0 +1,16 @@ +import { createTestClient, http } from "viem"; + +export const anvilHost = "127.0.0.1"; +export const anvilPort = 8555; + +// ID of the current test worker. Used by the `@viem/anvil` proxy server. +export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); + +export const anvilRpcUrl = `http://${anvilHost}:${anvilPort}/${poolId}`; + +export const testClient = createTestClient({ + mode: "anvil", + // TODO: if tests get slow, try switching to websockets? + transport: http(anvilRpcUrl), + pollingInterval: 10, +}); diff --git a/packages/store/ts/test/globalSetup.ts b/packages/store/ts/test/globalSetup.ts new file mode 100644 index 0000000000..f1594c0483 --- /dev/null +++ b/packages/store/ts/test/globalSetup.ts @@ -0,0 +1,19 @@ +import { startProxy as startAnvilProxy } from "@viem/anvil"; +import { anvilHost, anvilPort } from "./common"; +import { execa } from "execa"; + +export default async function globalSetup(): Promise<() => Promise> { + console.log("building mock game"); + await execa("pnpm", ["run", "build"], { + cwd: `${__dirname}/../../../../test/mock-game-contracts`, + }); + + const shutdownAnvilProxy = await startAnvilProxy({ + host: anvilHost, + port: anvilPort, + }); + + return async () => { + await shutdownAnvilProxy(); + }; +} diff --git a/packages/store/ts/test/mockGame.ts b/packages/store/ts/test/mockGame.ts new file mode 100644 index 0000000000..908a069f03 --- /dev/null +++ b/packages/store/ts/test/mockGame.ts @@ -0,0 +1,35 @@ +import { execa } from "execa"; +import { anvilRpcUrl } from "./common"; +import { Hex, isHex } from "viem"; +import config from "mock-game-contracts/mud.config"; +import worldAbi from "mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; + +export { config, worldAbi }; + +export async function deployMockGame(): Promise { + console.log("deploying mock game to", anvilRpcUrl); + const { stdout, stderr } = await execa( + "pnpm", + // skip build because its slow and we do it in global setup + // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... + ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], + { + cwd: `${__dirname}/../../../../test/mock-game-contracts`, + env: { + // anvil default account + PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + DEBUG: "mud:*", + }, + }, + ); + if (stderr) console.error(stderr); + if (stdout) console.log(stdout); + + const [, worldAddress] = stdout.match(/worldAddress: '(0x[0-9a-f]+)'/i) ?? []; + if (!isHex(worldAddress)) { + throw new Error("world address not found in output, did the deploy fail?"); + } + console.log("deployed mock game", worldAddress); + + return worldAddress; +} diff --git a/packages/store/ts/test/setup.ts b/packages/store/ts/test/setup.ts new file mode 100644 index 0000000000..35d83f4304 --- /dev/null +++ b/packages/store/ts/test/setup.ts @@ -0,0 +1,18 @@ +import { beforeAll, beforeEach } from "vitest"; +import { testClient } from "./common"; + +// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. +beforeAll(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); + +// Some tests execute transactions, so we restore chain state here. +beforeEach(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); diff --git a/packages/store/ts/test/summarizeLogs.ts b/packages/store/ts/test/summarizeLogs.ts new file mode 100644 index 0000000000..6969863076 --- /dev/null +++ b/packages/store/ts/test/summarizeLogs.ts @@ -0,0 +1,12 @@ +import { logSort, resourceToLabel, hexToResource } from "@latticexyz/common"; +import { StoreLog } from "../storeLog"; + +export function summarizeLogs(logs: StoreLog[]) { + return logs + .slice() + .sort(logSort) + .map( + ({ eventName, args: { tableId, keyTuple } }) => + `${eventName} ${resourceToLabel(hexToResource(tableId))} (${keyTuple})`, + ); +} diff --git a/packages/store/vitest.config.ts b/packages/store/vitest.config.ts index b6a66f2a98..c1a0c3a874 100644 --- a/packages/store/vitest.config.ts +++ b/packages/store/vitest.config.ts @@ -2,6 +2,17 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - globalSetup: "vitestSetup.ts", + globalSetup: ["vitestSetup.ts", "ts/test/globalSetup.ts"], + setupFiles: ["ts/test/setup.ts"], + // Temporarily set a low teardown timeout because anvil hangs otherwise + // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 + teardownTimeout: 500, + hookTimeout: 15000, + }, + server: { + watch: { + // we build+import this file in test setup, which causes vitest to restart in a loop unless we ignore it here + ignored: ["**/test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"], + }, }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdd0282240..7692e031de 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -147,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/cli: dependencies: @@ -289,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/common: dependencies: @@ -341,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/config: dependencies: @@ -455,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/explorer: dependencies: @@ -670,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/gas-report: dependencies: @@ -716,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/protocol-parser: dependencies: @@ -741,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/react: dependencies: @@ -793,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/recs: dependencies: @@ -818,10 +818,10 @@ importers: version: 8.3.4 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@20.12.12) + version: 29.5.0(@types/node@18.15.11) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) @@ -852,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -917,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store: dependencies: @@ -967,12 +967,18 @@ importers: '@types/node': specifier: ^18.15.11 version: 18.15.11 + '@viem/anvil': + specifier: ^0.0.7 + version: 0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10) ds-test: specifier: https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0 version: https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0 forge-std: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 + mock-game-contracts: + specifier: workspace:* + version: link:../../test/mock-game-contracts solhint: specifier: ^3.3.7 version: 3.3.7 @@ -984,7 +990,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-indexer: dependencies: @@ -1099,7 +1105,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-sync: dependencies: @@ -1196,7 +1202,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/utils: dependencies: @@ -1215,10 +1221,10 @@ importers: version: 27.4.1 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@18.15.11) + version: 29.5.0(@types/node@20.12.12) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) @@ -1297,7 +1303,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1337,7 +1343,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-modules: dependencies: @@ -1398,7 +1404,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -16275,6 +16281,17 @@ snapshots: - debug - utf-8-validate + '@viem/anvil@0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10)': + dependencies: + execa: 7.2.0 + get-port: 6.1.2 + http-proxy: 1.18.1(debug@4.3.7) + ws: 8.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - debug + - utf-8-validate + '@vitejs/plugin-react@4.3.1(vite@4.5.5(@types/node@20.12.12)(terser@5.33.0))': dependencies: '@babel/core': 7.25.2 @@ -18922,6 +18939,10 @@ snapshots: optionalDependencies: debug: 4.3.4 + follow-redirects@1.15.2(debug@4.3.7): + optionalDependencies: + debug: 4.3.7 + for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -19296,6 +19317,14 @@ snapshots: transitivePeerDependencies: - debug + http-proxy@1.18.1(debug@4.3.7): + dependencies: + eventemitter3: 4.0.7 + follow-redirects: 1.15.2(debug@4.3.7) + requires-port: 1.0.0 + transitivePeerDependencies: + - debug + http-shutdown@1.2.2: {} https-proxy-agent@5.0.1: @@ -23375,7 +23404,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 From cce0f1cad14ef1584d8321872b09e65347426872 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 14:51:02 +0100 Subject: [PATCH 05/32] sort logs before flattening --- packages/store/ts/flattenStoreLogs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/store/ts/flattenStoreLogs.ts b/packages/store/ts/flattenStoreLogs.ts index 67dee7b319..bd50b8ea17 100644 --- a/packages/store/ts/flattenStoreLogs.ts +++ b/packages/store/ts/flattenStoreLogs.ts @@ -2,16 +2,17 @@ import { Log, size } from "viem"; import { storeEventsAbi } from "./storeEventsAbi"; import { emptyRecord } from "./common"; import { StoreLog, StoreSetRecordLog } from "./storeLog"; -import { spliceHex } from "@latticexyz/common"; +import { logSort, spliceHex } from "@latticexyz/common"; function getKey(log: Log) { return [log.address, log.args.tableId, log.args.keyTuple.join(",")].join(":"); } export function flattenStoreLogs(logs: StoreLog[]): StoreSetRecordLog[] { + const sortedLogs = logs.slice().sort(logSort); const records = new Map(); - for (const log of logs) { + for (const log of sortedLogs) { const key = getKey(log); if (log.eventName === "Store_SetRecord") { From d63eff5ed5d0a527921dd48e195febcd8c43005f Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 14:59:03 +0100 Subject: [PATCH 06/32] convert others to getStoreLogs --- packages/cli/src/deploy/getResourceAccess.ts | 26 +++++++++--------- packages/cli/src/deploy/getResourceIds.ts | 3 ++- packages/cli/src/deploy/getTables.ts | 28 ++++++++++---------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/packages/cli/src/deploy/getResourceAccess.ts b/packages/cli/src/deploy/getResourceAccess.ts index 825ee4351c..6a793979bc 100644 --- a/packages/cli/src/deploy/getResourceAccess.ts +++ b/packages/cli/src/deploy/getResourceAccess.ts @@ -1,11 +1,11 @@ -import { Client, parseAbiItem, Hex, Address, getAddress } from "viem"; +import { Client, Hex, Address, getAddress } from "viem"; import { WorldDeploy } from "./common"; import { debug } from "./debug"; -import { storeSpliceStaticDataEvent } from "@latticexyz/store"; -import { getLogs } from "viem/actions"; import { decodeKey, getKeySchema, getSchemaTypes } from "@latticexyz/protocol-parser/internal"; import { getTableValue } from "./getTableValue"; import worldConfig from "@latticexyz/world/mud.config"; +import { fetchBlockLogs } from "@latticexyz/block-logs-stream"; +import { flattenStoreLogs, getStoreLogs } from "@latticexyz/store/internal"; export async function getResourceAccess({ client, @@ -14,21 +14,21 @@ export async function getResourceAccess({ readonly client: Client; readonly worldDeploy: WorldDeploy; }): Promise { - // This assumes we only use `ResourceAccess._set(...)`, which is true as of this writing. - // TODO: PR to viem's getLogs to accept topics array so we can filter on all store events and quickly recreate this table's current state - debug("looking up resource access for", worldDeploy.address); - const logs = await getLogs(client, { - strict: true, + const blockLogs = await fetchBlockLogs({ fromBlock: worldDeploy.deployBlock, toBlock: worldDeploy.stateBlock, - address: worldDeploy.address, - // our usage of `ResourceAccess._set(...)` emits a splice instead of set record - // TODO: https://github.com/latticexyz/mud/issues/479 - event: parseAbiItem(storeSpliceStaticDataEvent), - args: { tableId: worldConfig.namespaces.world.tables.ResourceAccess.tableId }, + async getLogs({ fromBlock, toBlock }) { + return getStoreLogs(client, { + address: worldDeploy.address, + fromBlock, + toBlock, + tableId: worldConfig.namespaces.world.tables.ResourceAccess.tableId, + }); + }, }); + const logs = flattenStoreLogs(blockLogs.flatMap((block) => block.logs)); const keys = logs.map((log) => decodeKey(getSchemaTypes(getKeySchema(worldConfig.namespaces.world.tables.ResourceAccess)), log.args.keyTuple), diff --git a/packages/cli/src/deploy/getResourceIds.ts b/packages/cli/src/deploy/getResourceIds.ts index ab59fa840d..cd050e5f43 100644 --- a/packages/cli/src/deploy/getResourceIds.ts +++ b/packages/cli/src/deploy/getResourceIds.ts @@ -26,8 +26,9 @@ export async function getResourceIds({ }); }, }); + const logs = flattenStoreLogs(blockLogs.flatMap((block) => block.logs)); - const resourceIds = flattenStoreLogs(blockLogs.flatMap((block) => block.logs)).map((log) => log.args.keyTuple[0]); + const resourceIds = logs.map((log) => log.args.keyTuple[0]); debug("found", resourceIds.length, "resource IDs for", worldDeploy.address); return resourceIds; diff --git a/packages/cli/src/deploy/getTables.ts b/packages/cli/src/deploy/getTables.ts index 91eb894558..f2624dc112 100644 --- a/packages/cli/src/deploy/getTables.ts +++ b/packages/cli/src/deploy/getTables.ts @@ -1,9 +1,7 @@ -import { Client, parseAbiItem, decodeAbiParameters, parseAbiParameters } from "viem"; +import { Client, decodeAbiParameters, parseAbiParameters } from "viem"; import { hexToResource } from "@latticexyz/common"; import { WorldDeploy } from "./common"; import { debug } from "./debug"; -import { storeSetRecordEvent } from "@latticexyz/store"; -import { getLogs } from "viem/actions"; import { decodeKey, decodeValueArgs, @@ -14,6 +12,8 @@ import { } from "@latticexyz/protocol-parser/internal"; import { Schema, Table } from "@latticexyz/config"; import storeConfig from "@latticexyz/store/mud.config"; +import { fetchBlockLogs } from "@latticexyz/block-logs-stream"; +import { flattenStoreLogs, getStoreLogs } from "@latticexyz/store/internal"; // TODO: add label and namespaceLabel once we register it onchain type DeployedTable = Omit; @@ -25,21 +25,21 @@ export async function getTables({ readonly client: Client; readonly worldDeploy: WorldDeploy; }): Promise[]> { - // This assumes we only use `Tables._set(...)`, which is true as of this writing. - // TODO: PR to viem's getLogs to accept topics array so we can filter on all store events and quickly recreate this table's current state - // TODO: consider moving this to a batched getRecord for Tables table - debug("looking up tables for", worldDeploy.address); - const logs = await getLogs(client, { - strict: true, - // this may fail for certain RPC providers with block range limits - // if so, could potentially use our fetchLogs helper (which does pagination) + + const blockLogs = await fetchBlockLogs({ fromBlock: worldDeploy.deployBlock, toBlock: worldDeploy.stateBlock, - address: worldDeploy.address, - event: parseAbiItem(storeSetRecordEvent), - args: { tableId: storeConfig.namespaces.store.tables.Tables.tableId }, + async getLogs({ fromBlock, toBlock }) { + return getStoreLogs(client, { + address: worldDeploy.address, + fromBlock, + toBlock, + tableId: storeConfig.namespaces.store.tables.Tables.tableId, + }); + }, }); + const logs = flattenStoreLogs(blockLogs.flatMap((block) => block.logs)); // TODO: combine with store-sync logToTable and export from somewhere const tables = logs.map((log): DeployedTable => { From d8706111b33a8db32808d949315bf003ce6fb365 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 15:03:41 +0100 Subject: [PATCH 07/32] add log sort test --- packages/common/src/logSort.test.ts | 84 +++++++++++++++++++++++++++++ packages/common/src/logSort.ts | 4 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 packages/common/src/logSort.test.ts diff --git a/packages/common/src/logSort.test.ts b/packages/common/src/logSort.test.ts new file mode 100644 index 0000000000..e42fa534dd --- /dev/null +++ b/packages/common/src/logSort.test.ts @@ -0,0 +1,84 @@ +import { describe, it, expect } from "vitest"; +import { logSort } from "./logSort"; + +describe("logSort", () => { + it("sorts logs", () => { + const logs = [ + { + blockNumber: 1n, + logIndex: 4, + }, + { + blockNumber: 5n, + logIndex: 0, + }, + { + blockNumber: 1n, + logIndex: 0, + }, + { + blockNumber: 1n, + logIndex: 2, + }, + { + blockNumber: 3n, + logIndex: 3, + }, + { + blockNumber: null, + logIndex: null, + }, + { + // both values should be null for pending blocks, + // but we'll include this as a test case anyway + blockNumber: 3n, + logIndex: null, + }, + { + // both values should be null for pending blocks, + // but we'll include this as a test case anyway + blockNumber: null, + logIndex: 1, + }, + ]; + + logs.sort(logSort); + + expect(logs).toMatchInlineSnapshot(` + [ + { + "blockNumber": 1n, + "logIndex": 0, + }, + { + "blockNumber": 1n, + "logIndex": 2, + }, + { + "blockNumber": 1n, + "logIndex": 4, + }, + { + "blockNumber": 3n, + "logIndex": 3, + }, + { + "blockNumber": 3n, + "logIndex": null, + }, + { + "blockNumber": 5n, + "logIndex": 0, + }, + { + "blockNumber": null, + "logIndex": 1, + }, + { + "blockNumber": null, + "logIndex": null, + }, + ] + `); + }); +}); diff --git a/packages/common/src/logSort.ts b/packages/common/src/logSort.ts index f3e9da1439..fd4c73a832 100644 --- a/packages/common/src/logSort.ts +++ b/packages/common/src/logSort.ts @@ -1,6 +1,8 @@ import { Log } from "viem"; -export function logSort(a: Log, b: Log): number { +type PartialLog = Pick; + +export function logSort(a: PartialLog, b: PartialLog): number { if (a.blockNumber === b.blockNumber) { if (a.logIndex === b.logIndex) return 0; if (a.logIndex == null) return 1; From c2c83357ec591681adfa25333ff16d82912251a8 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 15:09:43 +0100 Subject: [PATCH 08/32] this is more efficient --- .../src/groupLogsByBlockNumber.ts | 23 ++++++------------- packages/common/src/logSort.ts | 4 +--- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/packages/block-logs-stream/src/groupLogsByBlockNumber.ts b/packages/block-logs-stream/src/groupLogsByBlockNumber.ts index 82f6b8ba6e..1afcafff48 100644 --- a/packages/block-logs-stream/src/groupLogsByBlockNumber.ts +++ b/packages/block-logs-stream/src/groupLogsByBlockNumber.ts @@ -1,5 +1,6 @@ import { BlockNumber } from "viem"; -import { bigIntSort, isDefined } from "@latticexyz/common/utils"; +import { logSort } from "@latticexyz/common"; +import { bigIntSort, groupBy } from "@latticexyz/common/utils"; type PartialLog = { readonly blockNumber: bigint; readonly logIndex: number }; @@ -29,22 +30,12 @@ export function groupLogsByBlockNumber( const blockNumbers = Array.from(new Set(logs.map((log) => log.blockNumber))); blockNumbers.sort(bigIntSort); - const groupedBlocks = blockNumbers - .map((blockNumber) => { - const blockLogs = logs.filter((log) => log.blockNumber === blockNumber); - if (!blockLogs.length) return; - blockLogs.sort((a, b) => (a.logIndex < b.logIndex ? -1 : a.logIndex > b.logIndex ? 1 : 0)); + const sortedLogs = logs.slice().sort(logSort); + const groupedBlocks = Array.from(groupBy(sortedLogs, (log) => log.blockNumber).entries()) + .map(([blockNumber, logs]) => ({ blockNumber, logs })) + .filter((block) => block.logs.length > 0); - if (!blockLogs.length) return; - - return { - blockNumber, - logs: blockLogs, - }; - }) - .filter(isDefined); - - const lastBlockNumber = blockNumbers.length > 0 ? blockNumbers[blockNumbers.length - 1] : null; + const lastBlockNumber = blockNumbers.at(-1); if (toBlock != null && (lastBlockNumber == null || toBlock > lastBlockNumber)) { groupedBlocks.push({ diff --git a/packages/common/src/logSort.ts b/packages/common/src/logSort.ts index fd4c73a832..f37090e29d 100644 --- a/packages/common/src/logSort.ts +++ b/packages/common/src/logSort.ts @@ -1,6 +1,4 @@ -import { Log } from "viem"; - -type PartialLog = Pick; +type PartialLog = { readonly blockNumber: bigint; readonly logIndex: number }; export function logSort(a: PartialLog, b: PartialLog): number { if (a.blockNumber === b.blockNumber) { From b762d1def822db4541894aab15347943ac80b511 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 15:17:36 +0100 Subject: [PATCH 09/32] avoid circ dep --- packages/store/package.json | 1 - packages/store/ts/test/mockGame.ts | 4 +-- pnpm-lock.yaml | 39 ++++++++++++++---------------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/packages/store/package.json b/packages/store/package.json index 4ec6d2777e..b92b37aaba 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -79,7 +79,6 @@ "@viem/anvil": "^0.0.7", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", - "mock-game-contracts": "workspace:*", "solhint": "^3.3.7", "tsup": "^6.7.0", "tsx": "^3.12.6", diff --git a/packages/store/ts/test/mockGame.ts b/packages/store/ts/test/mockGame.ts index 908a069f03..3db0279503 100644 --- a/packages/store/ts/test/mockGame.ts +++ b/packages/store/ts/test/mockGame.ts @@ -1,8 +1,8 @@ import { execa } from "execa"; import { anvilRpcUrl } from "./common"; import { Hex, isHex } from "viem"; -import config from "mock-game-contracts/mud.config"; -import worldAbi from "mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; +import config from "../../../../test/mock-game-contracts/mud.config"; +import worldAbi from "../../../../test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; export { config, worldAbi }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7692e031de..70b7f501bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -147,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/cli: dependencies: @@ -289,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/common: dependencies: @@ -341,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/config: dependencies: @@ -455,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/explorer: dependencies: @@ -670,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/gas-report: dependencies: @@ -716,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/protocol-parser: dependencies: @@ -741,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/react: dependencies: @@ -793,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/recs: dependencies: @@ -852,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -917,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store: dependencies: @@ -976,9 +976,6 @@ importers: forge-std: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 - mock-game-contracts: - specifier: workspace:* - version: link:../../test/mock-game-contracts solhint: specifier: ^3.3.7 version: 3.3.7 @@ -990,7 +987,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-indexer: dependencies: @@ -1105,7 +1102,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-sync: dependencies: @@ -1202,7 +1199,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/utils: dependencies: @@ -1303,7 +1300,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1343,7 +1340,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-modules: dependencies: @@ -1404,7 +1401,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -23404,7 +23401,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 From d1fe395d1317a43887f34445e0741190f1920f50 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 16:30:42 +0100 Subject: [PATCH 10/32] fix sort type --- packages/common/src/logSort.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/logSort.ts b/packages/common/src/logSort.ts index f37090e29d..9c8927dc0c 100644 --- a/packages/common/src/logSort.ts +++ b/packages/common/src/logSort.ts @@ -1,4 +1,4 @@ -type PartialLog = { readonly blockNumber: bigint; readonly logIndex: number }; +type PartialLog = { readonly blockNumber: bigint | null; readonly logIndex: number | null }; export function logSort(a: PartialLog, b: PartialLog): number { if (a.blockNumber === b.blockNumber) { From cb8215944e28af09b852b61960cf32e1744b4068 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 16:55:37 +0100 Subject: [PATCH 11/32] pick another port --- packages/store/ts/test/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/store/ts/test/common.ts b/packages/store/ts/test/common.ts index e0fe53774e..8fb19fbef2 100644 --- a/packages/store/ts/test/common.ts +++ b/packages/store/ts/test/common.ts @@ -1,7 +1,7 @@ import { createTestClient, http } from "viem"; export const anvilHost = "127.0.0.1"; -export const anvilPort = 8555; +export const anvilPort = 8556; // ID of the current test worker. Used by the `@viem/anvil` proxy server. export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); From 0c2a475d63e968d46ea10bdf7cada594ec2a11ac Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 09:26:21 -0700 Subject: [PATCH 12/32] Create early-colts-smile.md --- .changeset/early-colts-smile.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/early-colts-smile.md diff --git a/.changeset/early-colts-smile.md b/.changeset/early-colts-smile.md new file mode 100644 index 0000000000..509dc9bf4a --- /dev/null +++ b/.changeset/early-colts-smile.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/block-logs-stream": patch +--- + +`fetchLogs` and `blockRangeToLogs` now accept a `getLogs` option to override the default behavior. From 56b0a87141114f2a4a2db7816f1b6a07c7059741 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 09:28:43 -0700 Subject: [PATCH 13/32] Create nervous-clouds-collect.md --- .changeset/nervous-clouds-collect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nervous-clouds-collect.md diff --git a/.changeset/nervous-clouds-collect.md b/.changeset/nervous-clouds-collect.md new file mode 100644 index 0000000000..0a670eee7c --- /dev/null +++ b/.changeset/nervous-clouds-collect.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/cli": patch +--- + +Deployer now has a better method for fetching store logs from the world that should be more efficient and resilient to block range errors. From 94fe7f848a348f3c5f70eb7ed45decc46716e18d Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 09:30:15 -0700 Subject: [PATCH 14/32] Create ten-llamas-protect.md --- .changeset/ten-llamas-protect.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .changeset/ten-llamas-protect.md diff --git a/.changeset/ten-llamas-protect.md b/.changeset/ten-llamas-protect.md new file mode 100644 index 0000000000..3d1a0de08f --- /dev/null +++ b/.changeset/ten-llamas-protect.md @@ -0,0 +1,12 @@ +--- +"@latticexyz/common": patch +--- + +Added `logSort` method to help when sorting logs fetched from RPC, where they come back ordered relative to the topics used. + +```ts +import { logSort } from "@latticexyz/common"; + +const logs = getLogs(...); +logs.sort(logSort); +``` From 874dfa2fcddac1d527a2b12984013546f64237c2 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 09:32:13 -0700 Subject: [PATCH 15/32] Create gold-mangos-sneeze.md --- .changeset/gold-mangos-sneeze.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/gold-mangos-sneeze.md diff --git a/.changeset/gold-mangos-sneeze.md b/.changeset/gold-mangos-sneeze.md new file mode 100644 index 0000000000..90c3f30762 --- /dev/null +++ b/.changeset/gold-mangos-sneeze.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store": patch +--- + +Added `getStoreLogs` and `flattenStoreLogs` to aid in fetching data from store contracts. For now, these are internal exports and considered unstable/experimental. From daf46481a8d3956796bb6026253916f7d7441948 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 4 Oct 2024 05:05:38 -0700 Subject: [PATCH 16/32] Update .changeset/nervous-clouds-collect.md --- .changeset/nervous-clouds-collect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/nervous-clouds-collect.md b/.changeset/nervous-clouds-collect.md index 0a670eee7c..4a2a776ae0 100644 --- a/.changeset/nervous-clouds-collect.md +++ b/.changeset/nervous-clouds-collect.md @@ -2,4 +2,4 @@ "@latticexyz/cli": patch --- -Deployer now has a better method for fetching store logs from the world that should be more efficient and resilient to block range errors. +Deployer now has a better method for fetching store logs from the world that should be more efficient and resilient to block range errors and rate limiting. From 0d7dddbca2eaa2b5b8b45663f5a68e79b3fb26ac Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 10:42:41 +0100 Subject: [PATCH 17/32] changeset should ignore private packages --- .changeset/config.json | 4 ++ test/mock-game-contracts/CHANGELOG.md | 55 --------------------------- test/mock-game-contracts/package.json | 2 +- test/ts-benchmarks/CHANGELOG.md | 27 ------------- test/ts-benchmarks/package.json | 2 +- 5 files changed, 6 insertions(+), 84 deletions(-) delete mode 100644 test/mock-game-contracts/CHANGELOG.md delete mode 100644 test/ts-benchmarks/CHANGELOG.md diff --git a/.changeset/config.json b/.changeset/config.json index 12d4b0e9bc..398e31a42b 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -11,6 +11,10 @@ "useCalculatedVersion": true, "prereleaseTemplate": "{tag}-{commit}" }, + "privatePackages": { + "tag": false, + "version": false + }, "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { "onlyUpdatePeerDependentsWhenOutOfRange": true } diff --git a/test/mock-game-contracts/CHANGELOG.md b/test/mock-game-contracts/CHANGELOG.md deleted file mode 100644 index 4a61cb5fdd..0000000000 --- a/test/mock-game-contracts/CHANGELOG.md +++ /dev/null @@ -1,55 +0,0 @@ -# mock-game-contracts - -## 2.2.10 - -## 2.2.9 - -## 2.2.8 - -## 2.2.7 - -## 2.2.6 - -## 2.2.5 - -## 2.2.4 - -## 2.2.3 - -## 2.2.2 - -## 2.2.1 - -## 2.2.0 - -## 2.1.1 - -## 2.1.0 - -## 2.0.12 - -## 2.0.11 - -## 2.0.10 - -## 2.0.9 - -## 2.0.8 - -## 2.0.7 - -## 2.0.6 - -## 2.0.5 - -## 2.0.4 - -## 2.0.3 - -## 2.0.2 - -## 2.0.1 - -## 2.0.0 - -## 2.0.0-next.18 diff --git a/test/mock-game-contracts/package.json b/test/mock-game-contracts/package.json index 6d094a3c8b..7676f32001 100644 --- a/test/mock-game-contracts/package.json +++ b/test/mock-game-contracts/package.json @@ -1,6 +1,6 @@ { "name": "mock-game-contracts", - "version": "2.2.10", + "version": "0.0.0", "private": true, "license": "MIT", "scripts": { diff --git a/test/ts-benchmarks/CHANGELOG.md b/test/ts-benchmarks/CHANGELOG.md deleted file mode 100644 index d9386e350b..0000000000 --- a/test/ts-benchmarks/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# ts-benchmarks - -## 2.2.10 - -## 2.2.9 - -## 2.2.8 - -## 2.2.7 - -## 2.2.6 - -## 2.2.5 - -## 2.2.4 - -## 2.2.3 - -## 2.2.2 - -## 2.2.1 - -## 2.2.0 - -## 2.1.1 - -## 2.1.0 diff --git a/test/ts-benchmarks/package.json b/test/ts-benchmarks/package.json index cb6447b0a4..d18dfb709f 100644 --- a/test/ts-benchmarks/package.json +++ b/test/ts-benchmarks/package.json @@ -1,6 +1,6 @@ { "name": "ts-benchmarks", - "version": "2.2.10", + "version": "0.0.0", "private": true, "license": "MIT", "scripts": { From 8e319e6dde441a778f6d3c3521e88ee519d14777 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 10:59:38 +0100 Subject: [PATCH 18/32] wip moving tests into its own package --- packages/store/ts/exports/internal.ts | 1 + pnpm-lock.yaml | 121 +++++++++-------- test/store/README.md | 1 + test/store/common.ts | 16 +++ test/store/flattenStoreLogs.test.ts | 180 ++++++++++++++++++++++++++ test/store/globalSetup.ts | 19 +++ test/store/mockGame.ts | 35 +++++ test/store/package.json | 21 +++ test/store/setup.ts | 18 +++ test/store/summarizeLogs.ts | 12 ++ test/store/tsconfig.json | 3 + 11 files changed, 376 insertions(+), 51 deletions(-) create mode 100644 test/store/README.md create mode 100644 test/store/common.ts create mode 100644 test/store/flattenStoreLogs.test.ts create mode 100644 test/store/globalSetup.ts create mode 100644 test/store/mockGame.ts create mode 100644 test/store/package.json create mode 100644 test/store/setup.ts create mode 100644 test/store/summarizeLogs.ts create mode 100644 test/store/tsconfig.json diff --git a/packages/store/ts/exports/internal.ts b/packages/store/ts/exports/internal.ts index 656d9b3a80..76568579d4 100644 --- a/packages/store/ts/exports/internal.ts +++ b/packages/store/ts/exports/internal.ts @@ -1,3 +1,4 @@ export * from "../common"; export * from "../getStoreLogs"; export * from "../flattenStoreLogs"; +export * from "../storeLog"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70b7f501bc..fdb0766e73 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -147,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/cli: dependencies: @@ -289,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/common: dependencies: @@ -341,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/config: dependencies: @@ -455,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/explorer: dependencies: @@ -670,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/gas-report: dependencies: @@ -716,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/protocol-parser: dependencies: @@ -741,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/react: dependencies: @@ -793,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/recs: dependencies: @@ -852,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -917,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store: dependencies: @@ -987,7 +987,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-indexer: dependencies: @@ -1102,7 +1102,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-sync: dependencies: @@ -1199,7 +1199,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/utils: dependencies: @@ -1300,7 +1300,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1340,7 +1340,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-modules: dependencies: @@ -1401,7 +1401,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -1430,6 +1430,30 @@ importers: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 + test/store: + devDependencies: + '@latticexyz/store': + specifier: workspace:* + version: link:../../packages/store + '@viem/anvil': + specifier: ^0.0.7 + version: 0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10) + mock-game-contracts: + specifier: workspace:* + version: link:../mock-game-contracts + tsx: + specifier: 4.16.2 + version: 4.16.2 + viem: + specifier: 'catalog:' + version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) + vite: + specifier: ^4.2.1 + version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) + vitest: + specifier: 0.34.6 + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + test/ts-benchmarks: devDependencies: '@latticexyz/recs': @@ -4524,9 +4548,6 @@ packages: resolution: {integrity: sha512-Y0yAxRaB98LFp2Dm+ACZqBSdAmI3FlpH/LjxOZ94g/ouuDJecSq0iR26XZ5QDuEL8Rf+L4jBJaoDC08CD0KkJw==} engines: {node: '>=16'} - '@scure/base@1.1.6': - resolution: {integrity: sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==} - '@scure/base@1.1.8': resolution: {integrity: sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==} @@ -13543,7 +13564,7 @@ snapshots: '@jest/console@29.5.0': dependencies: '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 jest-message-util: 29.5.0 jest-util: 29.5.0 @@ -13591,7 +13612,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 jest-mock: 29.5.0 '@jest/environment@29.7.0': @@ -13616,7 +13637,7 @@ snapshots: dependencies: '@jest/types': 29.5.0 '@sinonjs/fake-timers': 10.0.2 - '@types/node': 18.15.11 + '@types/node': 18.19.50 jest-message-util: 29.5.0 jest-mock: 29.5.0 jest-util: 29.7.0 @@ -13647,7 +13668,7 @@ snapshots: '@jest/transform': 29.5.0 '@jest/types': 29.5.0 '@jridgewell/trace-mapping': 0.3.18 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -13751,7 +13772,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/resolve-uri@3.1.0': {} @@ -13779,7 +13800,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@koa/cors@4.0.0': dependencies: @@ -13963,8 +13984,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -13977,8 +13998,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -15337,20 +15358,18 @@ snapshots: '@safe-global/safe-gateway-typescript-sdk@3.22.2': {} - '@scure/base@1.1.6': {} - '@scure/base@1.1.8': {} '@scure/bip32@1.4.0': dependencies: '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.3.0': dependencies: '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.4.0': dependencies: @@ -15913,7 +15932,7 @@ snapshots: '@types/connect@3.4.38': dependencies: - '@types/node': 18.15.11 + '@types/node': 18.19.50 '@types/content-disposition@0.5.8': {} @@ -19734,7 +19753,7 @@ snapshots: '@jest/expect': 29.5.0 '@jest/test-result': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -19746,7 +19765,7 @@ snapshots: jest-snapshot: 29.5.0 jest-util: 29.7.0 p-limit: 3.1.0 - pretty-format: 29.5.0 + pretty-format: 29.7.0 pure-rand: 6.0.1 slash: 3.0.0 stack-utils: 2.0.6 @@ -19861,7 +19880,7 @@ snapshots: chalk: 4.1.2 diff-sequences: 29.6.3 jest-get-type: 29.4.3 - pretty-format: 29.5.0 + pretty-format: 29.7.0 jest-docblock@29.4.3: dependencies: @@ -19880,7 +19899,7 @@ snapshots: '@jest/environment': 29.5.0 '@jest/fake-timers': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 jest-mock: 29.5.0 jest-util: 29.7.0 @@ -19903,7 +19922,7 @@ snapshots: dependencies: '@jest/types': 29.5.0 '@types/graceful-fs': 4.1.6 - '@types/node': 18.15.11 + '@types/node': 18.19.50 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -19918,7 +19937,7 @@ snapshots: jest-leak-detector@29.5.0: dependencies: jest-get-type: 29.4.3 - pretty-format: 29.5.0 + pretty-format: 29.7.0 jest-matcher-utils@27.5.1: dependencies: @@ -19932,7 +19951,7 @@ snapshots: chalk: 4.1.2 jest-diff: 29.5.0 jest-get-type: 29.4.3 - pretty-format: 29.5.0 + pretty-format: 29.7.0 jest-message-util@29.5.0: dependencies: @@ -19961,7 +19980,7 @@ snapshots: jest-mock@29.5.0: dependencies: '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 jest-util: 29.7.0 jest-mock@29.7.0: @@ -20002,7 +20021,7 @@ snapshots: '@jest/test-result': 29.5.0 '@jest/transform': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -20030,7 +20049,7 @@ snapshots: '@jest/test-result': 29.5.0 '@jest/transform': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 cjs-module-lexer: 1.2.2 collect-v8-coverage: 1.0.1 @@ -20079,7 +20098,7 @@ snapshots: jest-util@29.5.0: dependencies: '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.11 @@ -20116,7 +20135,7 @@ snapshots: dependencies: '@jest/test-result': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.15.11 + '@types/node': 18.19.50 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -20125,7 +20144,7 @@ snapshots: jest-worker@29.5.0: dependencies: - '@types/node': 18.15.11 + '@types/node': 18.19.50 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -23262,7 +23281,7 @@ snapshots: dependencies: browserslist: 4.23.0 escalade: 3.1.2 - picocolors: 1.0.0 + picocolors: 1.0.1 update-browserslist-db@1.1.0(browserslist@4.23.3): dependencies: @@ -23401,7 +23420,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 @@ -23492,7 +23511,7 @@ snapshots: webauthn-p256@0.0.5: dependencies: '@noble/curves': 1.4.2 - '@noble/hashes': 1.4.0 + '@noble/hashes': 1.5.0 webextension-polyfill@0.10.0: {} diff --git a/test/store/README.md b/test/store/README.md new file mode 100644 index 0000000000..aa7c1d110f --- /dev/null +++ b/test/store/README.md @@ -0,0 +1 @@ +Some of our tests in `store` package depend on other packages that would cause a circular dependency, so we've moved them here. diff --git a/test/store/common.ts b/test/store/common.ts new file mode 100644 index 0000000000..8fb19fbef2 --- /dev/null +++ b/test/store/common.ts @@ -0,0 +1,16 @@ +import { createTestClient, http } from "viem"; + +export const anvilHost = "127.0.0.1"; +export const anvilPort = 8556; + +// ID of the current test worker. Used by the `@viem/anvil` proxy server. +export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); + +export const anvilRpcUrl = `http://${anvilHost}:${anvilPort}/${poolId}`; + +export const testClient = createTestClient({ + mode: "anvil", + // TODO: if tests get slow, try switching to websockets? + transport: http(anvilRpcUrl), + pollingInterval: 10, +}); diff --git a/test/store/flattenStoreLogs.test.ts b/test/store/flattenStoreLogs.test.ts new file mode 100644 index 0000000000..5270224450 --- /dev/null +++ b/test/store/flattenStoreLogs.test.ts @@ -0,0 +1,180 @@ +/* eslint-disable max-len */ +import { beforeAll, describe, expect, it } from "vitest"; +import { deployMockGame } from "./test/mockGame"; +import { testClient } from "./test/common"; +import { getStoreLogs } from "./getStoreLogs"; +import { summarizeLogs } from "./test/summarizeLogs"; +import { flattenStoreLogs } from "./flattenStoreLogs"; + +describe("flattenStoreLogs", async () => { + beforeAll(async () => { + await deployMockGame(); + }); + + it("flattens store logs", async () => { + const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); + const flattenedLogs = flattenStoreLogs(logs); + + expect(summarizeLogs(flattenedLogs)).toMatchInlineSnapshot(` + [ + "Store_SetRecord world__InitModuleAddres ()", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", + "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", + "Store_SetRecord Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", + ] + `); + }); +}); diff --git a/test/store/globalSetup.ts b/test/store/globalSetup.ts new file mode 100644 index 0000000000..3f6ac0dabd --- /dev/null +++ b/test/store/globalSetup.ts @@ -0,0 +1,19 @@ +import { startProxy as startAnvilProxy } from "@viem/anvil"; +import { anvilHost, anvilPort } from "./common"; +import { execa } from "execa"; + +export default async function globalSetup(): Promise<() => Promise> { + console.log("building mock game"); + await execa("pnpm", ["run", "build"], { + cwd: `${__dirname}/../mock-game-contracts`, + }); + + const shutdownAnvilProxy = await startAnvilProxy({ + host: anvilHost, + port: anvilPort, + }); + + return async () => { + await shutdownAnvilProxy(); + }; +} diff --git a/test/store/mockGame.ts b/test/store/mockGame.ts new file mode 100644 index 0000000000..535ac97dd0 --- /dev/null +++ b/test/store/mockGame.ts @@ -0,0 +1,35 @@ +import { execa } from "execa"; +import { anvilRpcUrl } from "./common"; +import { Hex, isHex } from "viem"; +import config from "../mock-game-contracts/mud.config"; +import worldAbi from "../mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; + +export { config, worldAbi }; + +export async function deployMockGame(): Promise { + console.log("deploying mock game to", anvilRpcUrl); + const { stdout, stderr } = await execa( + "pnpm", + // skip build because its slow and we do it in global setup + // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... + ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], + { + cwd: `${__dirname}/../mock-game-contracts`, + env: { + // anvil default account + PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + DEBUG: "mud:*", + }, + }, + ); + if (stderr) console.error(stderr); + if (stdout) console.log(stdout); + + const [, worldAddress] = stdout.match(/worldAddress: '(0x[0-9a-f]+)'/i) ?? []; + if (!isHex(worldAddress)) { + throw new Error("world address not found in output, did the deploy fail?"); + } + console.log("deployed mock game", worldAddress); + + return worldAddress; +} diff --git a/test/store/package.json b/test/store/package.json new file mode 100644 index 0000000000..cfc420be59 --- /dev/null +++ b/test/store/package.json @@ -0,0 +1,21 @@ +{ + "name": "store-tests", + "version": "0.0.0", + "private": true, + "license": "MIT", + "scripts": { + "bench": "tsx ./bench", + "test": "pnpm run bench", + "test:ci": "pnpm run test" + }, + "devDependencies": { + "@latticexyz/common": "workspace:*", + "@latticexyz/store": "workspace:*", + "@viem/anvil": "^0.0.7", + "mock-game-contracts": "workspace:*", + "tsx": "4.16.2", + "viem": "catalog:", + "vite": "^4.2.1", + "vitest": "0.34.6" + } +} diff --git a/test/store/setup.ts b/test/store/setup.ts new file mode 100644 index 0000000000..35d83f4304 --- /dev/null +++ b/test/store/setup.ts @@ -0,0 +1,18 @@ +import { beforeAll, beforeEach } from "vitest"; +import { testClient } from "./common"; + +// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. +beforeAll(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); + +// Some tests execute transactions, so we restore chain state here. +beforeEach(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); diff --git a/test/store/summarizeLogs.ts b/test/store/summarizeLogs.ts new file mode 100644 index 0000000000..21cd0dafba --- /dev/null +++ b/test/store/summarizeLogs.ts @@ -0,0 +1,12 @@ +import { logSort, resourceToLabel, hexToResource } from "@latticexyz/common"; +import { StoreLog } from "@latticexyz/store/internal"; + +export function summarizeLogs(logs: StoreLog[]) { + return logs + .slice() + .sort(logSort) + .map( + ({ eventName, args: { tableId, keyTuple } }) => + `${eventName} ${resourceToLabel(hexToResource(tableId))} (${keyTuple})`, + ); +} diff --git a/test/store/tsconfig.json b/test/store/tsconfig.json new file mode 100644 index 0000000000..dc787c60b2 --- /dev/null +++ b/test/store/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": ["../../tsconfig.json"] +} From c46145e98b1d7e1842bd21fd8a498630de58a073 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 10:59:41 +0100 Subject: [PATCH 19/32] Revert "wip moving tests into its own package" This reverts commit 8e319e6dde441a778f6d3c3521e88ee519d14777. --- packages/store/ts/exports/internal.ts | 1 - pnpm-lock.yaml | 121 ++++++++--------- test/store/README.md | 1 - test/store/common.ts | 16 --- test/store/flattenStoreLogs.test.ts | 180 -------------------------- test/store/globalSetup.ts | 19 --- test/store/mockGame.ts | 35 ----- test/store/package.json | 21 --- test/store/setup.ts | 18 --- test/store/summarizeLogs.ts | 12 -- test/store/tsconfig.json | 3 - 11 files changed, 51 insertions(+), 376 deletions(-) delete mode 100644 test/store/README.md delete mode 100644 test/store/common.ts delete mode 100644 test/store/flattenStoreLogs.test.ts delete mode 100644 test/store/globalSetup.ts delete mode 100644 test/store/mockGame.ts delete mode 100644 test/store/package.json delete mode 100644 test/store/setup.ts delete mode 100644 test/store/summarizeLogs.ts delete mode 100644 test/store/tsconfig.json diff --git a/packages/store/ts/exports/internal.ts b/packages/store/ts/exports/internal.ts index 76568579d4..656d9b3a80 100644 --- a/packages/store/ts/exports/internal.ts +++ b/packages/store/ts/exports/internal.ts @@ -1,4 +1,3 @@ export * from "../common"; export * from "../getStoreLogs"; export * from "../flattenStoreLogs"; -export * from "../storeLog"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdb0766e73..70b7f501bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -147,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/cli: dependencies: @@ -289,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/common: dependencies: @@ -341,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/config: dependencies: @@ -455,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/explorer: dependencies: @@ -670,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/gas-report: dependencies: @@ -716,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/protocol-parser: dependencies: @@ -741,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/react: dependencies: @@ -793,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/recs: dependencies: @@ -852,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -917,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store: dependencies: @@ -987,7 +987,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-indexer: dependencies: @@ -1102,7 +1102,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-sync: dependencies: @@ -1199,7 +1199,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/utils: dependencies: @@ -1300,7 +1300,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1340,7 +1340,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/world-modules: dependencies: @@ -1401,7 +1401,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -1430,30 +1430,6 @@ importers: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 - test/store: - devDependencies: - '@latticexyz/store': - specifier: workspace:* - version: link:../../packages/store - '@viem/anvil': - specifier: ^0.0.7 - version: 0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10) - mock-game-contracts: - specifier: workspace:* - version: link:../mock-game-contracts - tsx: - specifier: 4.16.2 - version: 4.16.2 - viem: - specifier: 'catalog:' - version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) - vite: - specifier: ^4.2.1 - version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) - vitest: - specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) - test/ts-benchmarks: devDependencies: '@latticexyz/recs': @@ -4548,6 +4524,9 @@ packages: resolution: {integrity: sha512-Y0yAxRaB98LFp2Dm+ACZqBSdAmI3FlpH/LjxOZ94g/ouuDJecSq0iR26XZ5QDuEL8Rf+L4jBJaoDC08CD0KkJw==} engines: {node: '>=16'} + '@scure/base@1.1.6': + resolution: {integrity: sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==} + '@scure/base@1.1.8': resolution: {integrity: sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==} @@ -13564,7 +13543,7 @@ snapshots: '@jest/console@29.5.0': dependencies: '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 jest-message-util: 29.5.0 jest-util: 29.5.0 @@ -13612,7 +13591,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 jest-mock: 29.5.0 '@jest/environment@29.7.0': @@ -13637,7 +13616,7 @@ snapshots: dependencies: '@jest/types': 29.5.0 '@sinonjs/fake-timers': 10.0.2 - '@types/node': 18.19.50 + '@types/node': 18.15.11 jest-message-util: 29.5.0 jest-mock: 29.5.0 jest-util: 29.7.0 @@ -13668,7 +13647,7 @@ snapshots: '@jest/transform': 29.5.0 '@jest/types': 29.5.0 '@jridgewell/trace-mapping': 0.3.18 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -13772,7 +13751,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/resolve-uri@3.1.0': {} @@ -13800,7 +13779,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/sourcemap-codec': 1.4.15 '@koa/cors@4.0.0': dependencies: @@ -13984,8 +13963,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.5.0 - '@scure/base': 1.1.8 + '@noble/hashes': 1.4.0 + '@scure/base': 1.1.6 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -13998,8 +13977,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.5.0 - '@scure/base': 1.1.8 + '@noble/hashes': 1.4.0 + '@scure/base': 1.1.6 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -15358,18 +15337,20 @@ snapshots: '@safe-global/safe-gateway-typescript-sdk@3.22.2': {} + '@scure/base@1.1.6': {} + '@scure/base@1.1.8': {} '@scure/bip32@1.4.0': dependencies: '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 - '@scure/base': 1.1.8 + '@scure/base': 1.1.6 '@scure/bip39@1.3.0': dependencies: '@noble/hashes': 1.4.0 - '@scure/base': 1.1.8 + '@scure/base': 1.1.6 '@scure/bip39@1.4.0': dependencies: @@ -15932,7 +15913,7 @@ snapshots: '@types/connect@3.4.38': dependencies: - '@types/node': 18.19.50 + '@types/node': 18.15.11 '@types/content-disposition@0.5.8': {} @@ -19753,7 +19734,7 @@ snapshots: '@jest/expect': 29.5.0 '@jest/test-result': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -19765,7 +19746,7 @@ snapshots: jest-snapshot: 29.5.0 jest-util: 29.7.0 p-limit: 3.1.0 - pretty-format: 29.7.0 + pretty-format: 29.5.0 pure-rand: 6.0.1 slash: 3.0.0 stack-utils: 2.0.6 @@ -19880,7 +19861,7 @@ snapshots: chalk: 4.1.2 diff-sequences: 29.6.3 jest-get-type: 29.4.3 - pretty-format: 29.7.0 + pretty-format: 29.5.0 jest-docblock@29.4.3: dependencies: @@ -19899,7 +19880,7 @@ snapshots: '@jest/environment': 29.5.0 '@jest/fake-timers': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 jest-mock: 29.5.0 jest-util: 29.7.0 @@ -19922,7 +19903,7 @@ snapshots: dependencies: '@jest/types': 29.5.0 '@types/graceful-fs': 4.1.6 - '@types/node': 18.19.50 + '@types/node': 18.15.11 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -19937,7 +19918,7 @@ snapshots: jest-leak-detector@29.5.0: dependencies: jest-get-type: 29.4.3 - pretty-format: 29.7.0 + pretty-format: 29.5.0 jest-matcher-utils@27.5.1: dependencies: @@ -19951,7 +19932,7 @@ snapshots: chalk: 4.1.2 jest-diff: 29.5.0 jest-get-type: 29.4.3 - pretty-format: 29.7.0 + pretty-format: 29.5.0 jest-message-util@29.5.0: dependencies: @@ -19980,7 +19961,7 @@ snapshots: jest-mock@29.5.0: dependencies: '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 jest-util: 29.7.0 jest-mock@29.7.0: @@ -20021,7 +20002,7 @@ snapshots: '@jest/test-result': 29.5.0 '@jest/transform': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -20049,7 +20030,7 @@ snapshots: '@jest/test-result': 29.5.0 '@jest/transform': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 cjs-module-lexer: 1.2.2 collect-v8-coverage: 1.0.1 @@ -20098,7 +20079,7 @@ snapshots: jest-util@29.5.0: dependencies: '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.11 @@ -20135,7 +20116,7 @@ snapshots: dependencies: '@jest/test-result': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.19.50 + '@types/node': 18.15.11 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -20144,7 +20125,7 @@ snapshots: jest-worker@29.5.0: dependencies: - '@types/node': 18.19.50 + '@types/node': 18.15.11 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -23281,7 +23262,7 @@ snapshots: dependencies: browserslist: 4.23.0 escalade: 3.1.2 - picocolors: 1.0.1 + picocolors: 1.0.0 update-browserslist-db@1.1.0(browserslist@4.23.3): dependencies: @@ -23420,7 +23401,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 @@ -23511,7 +23492,7 @@ snapshots: webauthn-p256@0.0.5: dependencies: '@noble/curves': 1.4.2 - '@noble/hashes': 1.5.0 + '@noble/hashes': 1.4.0 webextension-polyfill@0.10.0: {} diff --git a/test/store/README.md b/test/store/README.md deleted file mode 100644 index aa7c1d110f..0000000000 --- a/test/store/README.md +++ /dev/null @@ -1 +0,0 @@ -Some of our tests in `store` package depend on other packages that would cause a circular dependency, so we've moved them here. diff --git a/test/store/common.ts b/test/store/common.ts deleted file mode 100644 index 8fb19fbef2..0000000000 --- a/test/store/common.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createTestClient, http } from "viem"; - -export const anvilHost = "127.0.0.1"; -export const anvilPort = 8556; - -// ID of the current test worker. Used by the `@viem/anvil` proxy server. -export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); - -export const anvilRpcUrl = `http://${anvilHost}:${anvilPort}/${poolId}`; - -export const testClient = createTestClient({ - mode: "anvil", - // TODO: if tests get slow, try switching to websockets? - transport: http(anvilRpcUrl), - pollingInterval: 10, -}); diff --git a/test/store/flattenStoreLogs.test.ts b/test/store/flattenStoreLogs.test.ts deleted file mode 100644 index 5270224450..0000000000 --- a/test/store/flattenStoreLogs.test.ts +++ /dev/null @@ -1,180 +0,0 @@ -/* eslint-disable max-len */ -import { beforeAll, describe, expect, it } from "vitest"; -import { deployMockGame } from "./test/mockGame"; -import { testClient } from "./test/common"; -import { getStoreLogs } from "./getStoreLogs"; -import { summarizeLogs } from "./test/summarizeLogs"; -import { flattenStoreLogs } from "./flattenStoreLogs"; - -describe("flattenStoreLogs", async () => { - beforeAll(async () => { - await deployMockGame(); - }); - - it("flattens store logs", async () => { - const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); - const flattenedLogs = flattenStoreLogs(logs); - - expect(summarizeLogs(flattenedLogs)).toMatchInlineSnapshot(` - [ - "Store_SetRecord world__InitModuleAddres ()", - "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", - "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", - "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", - "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", - "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", - "Store_SetRecord store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", - "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", - "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", - "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", - "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", - "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", - "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", - "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", - "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", - "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", - "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", - "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", - "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", - "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", - "Store_SetRecord store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", - "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", - "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", - "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", - "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", - "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", - "Store_SetRecord store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", - "Store_SetRecord store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", - "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", - "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", - "Store_SetRecord world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", - "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", - "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", - "Store_SetRecord world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", - "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", - "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", - "Store_SetRecord world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", - "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", - "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", - "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", - "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", - "Store_SetRecord world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", - "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", - "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", - "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", - "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", - "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", - "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", - "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", - "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", - "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", - "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", - "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", - "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", - "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", - "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", - "Store_SetRecord world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", - "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", - "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", - "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", - "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", - "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", - "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", - "Store_SetRecord store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", - "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", - "Store_SetRecord store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", - "Store_SetRecord store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", - "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", - "Store_SetRecord world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", - "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", - "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", - "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", - "Store_SetRecord world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", - "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", - "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", - "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", - "Store_SetRecord Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", - "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", - "Store_SetRecord Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", - "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", - "Store_SetRecord Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", - "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", - "Store_SetRecord Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", - ] - `); - }); -}); diff --git a/test/store/globalSetup.ts b/test/store/globalSetup.ts deleted file mode 100644 index 3f6ac0dabd..0000000000 --- a/test/store/globalSetup.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { startProxy as startAnvilProxy } from "@viem/anvil"; -import { anvilHost, anvilPort } from "./common"; -import { execa } from "execa"; - -export default async function globalSetup(): Promise<() => Promise> { - console.log("building mock game"); - await execa("pnpm", ["run", "build"], { - cwd: `${__dirname}/../mock-game-contracts`, - }); - - const shutdownAnvilProxy = await startAnvilProxy({ - host: anvilHost, - port: anvilPort, - }); - - return async () => { - await shutdownAnvilProxy(); - }; -} diff --git a/test/store/mockGame.ts b/test/store/mockGame.ts deleted file mode 100644 index 535ac97dd0..0000000000 --- a/test/store/mockGame.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { execa } from "execa"; -import { anvilRpcUrl } from "./common"; -import { Hex, isHex } from "viem"; -import config from "../mock-game-contracts/mud.config"; -import worldAbi from "../mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; - -export { config, worldAbi }; - -export async function deployMockGame(): Promise { - console.log("deploying mock game to", anvilRpcUrl); - const { stdout, stderr } = await execa( - "pnpm", - // skip build because its slow and we do it in global setup - // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... - ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], - { - cwd: `${__dirname}/../mock-game-contracts`, - env: { - // anvil default account - PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", - DEBUG: "mud:*", - }, - }, - ); - if (stderr) console.error(stderr); - if (stdout) console.log(stdout); - - const [, worldAddress] = stdout.match(/worldAddress: '(0x[0-9a-f]+)'/i) ?? []; - if (!isHex(worldAddress)) { - throw new Error("world address not found in output, did the deploy fail?"); - } - console.log("deployed mock game", worldAddress); - - return worldAddress; -} diff --git a/test/store/package.json b/test/store/package.json deleted file mode 100644 index cfc420be59..0000000000 --- a/test/store/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "store-tests", - "version": "0.0.0", - "private": true, - "license": "MIT", - "scripts": { - "bench": "tsx ./bench", - "test": "pnpm run bench", - "test:ci": "pnpm run test" - }, - "devDependencies": { - "@latticexyz/common": "workspace:*", - "@latticexyz/store": "workspace:*", - "@viem/anvil": "^0.0.7", - "mock-game-contracts": "workspace:*", - "tsx": "4.16.2", - "viem": "catalog:", - "vite": "^4.2.1", - "vitest": "0.34.6" - } -} diff --git a/test/store/setup.ts b/test/store/setup.ts deleted file mode 100644 index 35d83f4304..0000000000 --- a/test/store/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { beforeAll, beforeEach } from "vitest"; -import { testClient } from "./common"; - -// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. -beforeAll(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); - -// Some tests execute transactions, so we restore chain state here. -beforeEach(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); diff --git a/test/store/summarizeLogs.ts b/test/store/summarizeLogs.ts deleted file mode 100644 index 21cd0dafba..0000000000 --- a/test/store/summarizeLogs.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { logSort, resourceToLabel, hexToResource } from "@latticexyz/common"; -import { StoreLog } from "@latticexyz/store/internal"; - -export function summarizeLogs(logs: StoreLog[]) { - return logs - .slice() - .sort(logSort) - .map( - ({ eventName, args: { tableId, keyTuple } }) => - `${eventName} ${resourceToLabel(hexToResource(tableId))} (${keyTuple})`, - ); -} diff --git a/test/store/tsconfig.json b/test/store/tsconfig.json deleted file mode 100644 index dc787c60b2..0000000000 --- a/test/store/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["../../tsconfig.json"] -} From 908c0e6004e6d9ed4604a8999d7d6867e5ede6b3 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 11:56:03 +0100 Subject: [PATCH 20/32] move store ts test to monorepo root --- package.json | 7 +- packages/config/src/exports/internal.ts | 1 + packages/store/package.json | 5 +- packages/store/ts/flattenStoreLogs.test.ts | 15 +- packages/store/ts/getStoreLogs.test.ts | 13 +- packages/store/ts/protocolVersions.test.ts | 4 +- packages/world-modules/package.json | 1 - packages/world/package.json | 1 - pnpm-lock.yaml | 737 +++++++++++++++--- pnpm-workspace.yaml | 3 +- .../ts/test/setup.ts => test-setup/anvil.ts | 0 .../store/ts/test => test-setup}/common.ts | 7 + .../global/anvil.ts | 4 +- .../global/arktype.ts | 0 .../store/ts/test => test-setup}/mockGame.ts | 6 +- .../vitest.config.ts => vitest.config.ts | 6 +- 16 files changed, 666 insertions(+), 144 deletions(-) rename packages/store/ts/test/setup.ts => test-setup/anvil.ts (100%) rename {packages/store/ts/test => test-setup}/common.ts (73%) rename packages/store/ts/test/globalSetup.ts => test-setup/global/anvil.ts (79%) rename packages/store/vitestSetup.ts => test-setup/global/arktype.ts (100%) rename {packages/store/ts/test => test-setup}/mockGame.ts (83%) rename packages/store/vitest.config.ts => vitest.config.ts (66%) diff --git a/package.json b/package.json index 07976f4c1a..42de8756cd 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,10 @@ "@types/node": "^18.15.11", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", + "@viem/anvil": "^0.0.7", "chalk": "^5.2.0", "eslint": "8.57.0", - "execa": "^7.0.0", + "execa": "^9.4.0", "glob": "^10.4.2", "husky": ">=6", "lint-staged": "^15.2.10", @@ -54,7 +55,9 @@ "sort-package-json": "^2.10.1", "tsx": "4.16.2", "turbo": "^1.9.3", - "typescript": "5.4.2" + "typescript": "5.4.2", + "viem": "catalog:", + "vitest": "2.1.2" }, "packageManager": "pnpm@9.6.0", "engines": { diff --git a/packages/config/src/exports/internal.ts b/packages/config/src/exports/internal.ts index e69de29bb2..bf20023148 100644 --- a/packages/config/src/exports/internal.ts +++ b/packages/config/src/exports/internal.ts @@ -0,0 +1 @@ +// Nothing here yet. diff --git a/packages/store/package.json b/packages/store/package.json index b92b37aaba..3214f3cf36 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -74,14 +74,11 @@ "@latticexyz/gas-report": "workspace:*", "@types/debug": "^4.1.7", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", - "@viem/anvil": "^0.0.7", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", "solhint": "^3.3.7", "tsup": "^6.7.0", - "tsx": "^3.12.6", - "vitest": "0.34.6" + "tsx": "^3.12.6" } } diff --git a/packages/store/ts/flattenStoreLogs.test.ts b/packages/store/ts/flattenStoreLogs.test.ts index 5270224450..05c0ca5c34 100644 --- a/packages/store/ts/flattenStoreLogs.test.ts +++ b/packages/store/ts/flattenStoreLogs.test.ts @@ -1,15 +1,18 @@ /* eslint-disable max-len */ -import { beforeAll, describe, expect, it } from "vitest"; -import { deployMockGame } from "./test/mockGame"; -import { testClient } from "./test/common"; +import { beforeAll, beforeEach, describe, expect, it } from "vitest"; import { getStoreLogs } from "./getStoreLogs"; -import { summarizeLogs } from "./test/summarizeLogs"; import { flattenStoreLogs } from "./flattenStoreLogs"; +import { snapshotAnvilState, testClient } from "../../../test-setup/common"; +import { deployMockGame } from "../../../test-setup/mockGame"; +import { summarizeLogs } from "./test/summarizeLogs"; describe("flattenStoreLogs", async () => { beforeAll(async () => { + const resetAnvilState = await snapshotAnvilState(); await deployMockGame(); + return resetAnvilState; }); + beforeEach(snapshotAnvilState); it("flattens store logs", async () => { const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); @@ -132,8 +135,8 @@ describe("flattenStoreLogs", async () => { "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", - "Store_SetRecord world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", - "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000909d87ff2af6abace4fe66171b9622bc10305c3c)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000909d87ff2af6abace4fe66171b9622bc10305c3c)", "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", diff --git a/packages/store/ts/getStoreLogs.test.ts b/packages/store/ts/getStoreLogs.test.ts index 5292ac47f5..ccae995140 100644 --- a/packages/store/ts/getStoreLogs.test.ts +++ b/packages/store/ts/getStoreLogs.test.ts @@ -1,15 +1,18 @@ /* eslint-disable max-len */ -import { beforeAll, describe, expect, it } from "vitest"; -import { deployMockGame } from "./test/mockGame"; -import { testClient } from "./test/common"; +import { beforeAll, beforeEach, describe, expect, it } from "vitest"; import { getStoreLogs } from "./getStoreLogs"; import config from "../mud.config"; +import { snapshotAnvilState, testClient } from "../../../test-setup/common"; +import { deployMockGame } from "../../../test-setup/mockGame"; import { summarizeLogs } from "./test/summarizeLogs"; describe("getStoreLogs", async () => { beforeAll(async () => { + const resetAnvilState = await snapshotAnvilState(); await deployMockGame(); + return resetAnvilState; }); + beforeEach(snapshotAnvilState); it("fetches only store logs", async () => { const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); @@ -155,8 +158,8 @@ describe("getStoreLogs", async () => { "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", - "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", - "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000909d87ff2af6abace4fe66171b9622bc10305c3c)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000909d87ff2af6abace4fe66171b9622bc10305c3c)", "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", diff --git a/packages/store/ts/protocolVersions.test.ts b/packages/store/ts/protocolVersions.test.ts index 5ea35f76be..d8072469db 100644 --- a/packages/store/ts/protocolVersions.test.ts +++ b/packages/store/ts/protocolVersions.test.ts @@ -19,7 +19,9 @@ import { protocolVersions } from "./protocolVersions"; const [, currentVersion] = fs.readFileSync(`${__dirname}/../src/version.sol`, "utf8").match(/VERSION = "(.*?)"/) ?? []; -const currentAbi = formatAbi(StoreAbi).sort((a, b) => a.localeCompare(b)); +const currentAbi = formatAbi(StoreAbi) + .slice() + .sort((a, b) => a.localeCompare(b)); describe("Store protocol version", () => { it("is up to date", async () => { diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index 9134915252..f97180763b 100644 --- a/packages/world-modules/package.json +++ b/packages/world-modules/package.json @@ -54,7 +54,6 @@ "@latticexyz/cli": "workspace:*", "@latticexyz/gas-report": "workspace:*", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", diff --git a/packages/world/package.json b/packages/world/package.json index da358eacc4..5442d5d7a8 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -75,7 +75,6 @@ "@latticexyz/gas-report": "workspace:*", "@types/debug": "^4.1.7", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "ejs": "^3.1.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70b7f501bc..0b823dca52 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: '@typescript-eslint/parser': specifier: 7.1.1 version: 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@viem/anvil': + specifier: ^0.0.7 + version: 0.0.7(bufferutil@4.0.8)(debug@4.3.4)(utf-8-validate@5.0.10) chalk: specifier: ^5.2.0 version: 5.2.0 @@ -54,8 +57,8 @@ importers: specifier: 8.57.0 version: 8.57.0 execa: - specifier: ^7.0.0 - version: 7.0.0 + specifier: ^9.4.0 + version: 9.4.0 glob: specifier: ^10.4.2 version: 10.4.2 @@ -86,6 +89,12 @@ importers: typescript: specifier: 5.4.2 version: 5.4.2 + viem: + specifier: 'catalog:' + version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) + vitest: + specifier: 2.1.2 + version: 2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/abi-ts: dependencies: @@ -116,10 +125,10 @@ importers: version: 17.0.23 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -144,10 +153,10 @@ importers: version: 4.1.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/cli: dependencies: @@ -283,13 +292,13 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/common: dependencies: @@ -338,10 +347,10 @@ importers: version: 0.0.7(bufferutil@4.0.8)(debug@4.3.4)(utf-8-validate@5.0.10) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/config: dependencies: @@ -366,7 +375,7 @@ importers: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/create-mud: dependencies: @@ -379,7 +388,7 @@ importers: version: 18.15.11 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/dev-tools: dependencies: @@ -455,7 +464,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/explorer: dependencies: @@ -512,7 +521,7 @@ importers: version: 3.1.3(@types/react-dom@18.2.7)(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@rainbow-me/rainbowkit': specifier: ^2.1.5 - version: 2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)) + version: 2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)) '@tanstack/react-query': specifier: ^5.51.3 version: 5.52.0(react@18.2.0) @@ -572,7 +581,7 @@ importers: version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) wagmi: specifier: 'catalog:' - version: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + version: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) yargs: specifier: ^17.7.1 version: 17.7.2 @@ -664,13 +673,13 @@ importers: version: 4.1.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/gas-report: dependencies: @@ -713,10 +722,10 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/protocol-parser: dependencies: @@ -738,10 +747,10 @@ importers: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/react: dependencies: @@ -787,13 +796,13 @@ importers: version: 18.2.0(react@18.2.0) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vite: specifier: ^4.3.6 version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/recs: dependencies: @@ -824,7 +833,7 @@ importers: version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) type-fest: specifier: ^2.14.0 version: 2.14.0 @@ -849,16 +858,16 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/solhint-config-mud: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/solhint-plugin-mud: dependencies: @@ -871,7 +880,7 @@ importers: version: 18.15.11 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/stash: dependencies: @@ -914,10 +923,10 @@ importers: version: 18.2.0(react@18.2.0) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store: dependencies: @@ -961,15 +970,9 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 - '@viem/anvil': - specifier: ^0.0.7 - version: 0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10) ds-test: specifier: https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0 version: https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0 @@ -981,13 +984,10 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 - vitest: - specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) packages/store-indexer: dependencies: @@ -1096,13 +1096,13 @@ importers: version: 8.2.2 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-sync: dependencies: @@ -1196,10 +1196,10 @@ importers: version: link:../../test/mock-game-contracts tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/utils: dependencies: @@ -1224,7 +1224,7 @@ importers: version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/world: dependencies: @@ -1271,9 +1271,6 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -1294,13 +1291,13 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1334,13 +1331,13 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-modules: dependencies: @@ -1375,9 +1372,6 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -1395,13 +1389,13 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -4511,6 +4505,86 @@ packages: resolution: {integrity: sha512-N13NRw3T2+6Xi9J//3CGLsK2OqC8NMme3d/YX+nh05K9YHWGcv8DycHJrqGScSP4T75o8IN6nqIMhVFU8ohg8w==} engines: {node: '>=14'} + '@rollup/rollup-android-arm-eabi@4.24.0': + resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.24.0': + resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.24.0': + resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.24.0': + resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.24.0': + resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.24.0': + resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.24.0': + resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.24.0': + resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.24.0': + resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.24.0': + resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.24.0': + resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-win32-arm64-msvc@4.24.0': + resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.24.0': + resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.24.0': + resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} + cpu: [x64] + os: [win32] + '@rushstack/eslint-patch@1.10.4': resolution: {integrity: sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==} @@ -4524,9 +4598,6 @@ packages: resolution: {integrity: sha512-Y0yAxRaB98LFp2Dm+ACZqBSdAmI3FlpH/LjxOZ94g/ouuDJecSq0iR26XZ5QDuEL8Rf+L4jBJaoDC08CD0KkJw==} engines: {node: '>=16'} - '@scure/base@1.1.6': - resolution: {integrity: sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==} - '@scure/base@1.1.8': resolution: {integrity: sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==} @@ -4539,6 +4610,9 @@ packages: '@scure/bip39@1.4.0': resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} + '@sec-ant/readable-stream@0.4.1': + resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + '@sentry-internal/tracing@7.86.0': resolution: {integrity: sha512-b4dUsNWlPWRwakGwR7bhOkqiFlqQszH1hhVFwrm/8s3kqEBZ+E4CeIfCvuHBHQ1cM/fx55xpXX/BU163cy+3iQ==} engines: {node: '>=8'} @@ -4583,6 +4657,10 @@ packages: '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + '@sinonjs/commons@2.0.0': resolution: {integrity: sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==} @@ -4953,6 +5031,9 @@ packages: '@types/emscripten@1.39.6': resolution: {integrity: sha512-H90aoynNhhkQP6DRweEjJp5vfUVdIj7tdPLsu7pq89vODD/lcugKfZOsfgwpvM6XUewEp2N5dCg1Uf3Qe55Dcg==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/express-serve-static-core@4.17.41': resolution: {integrity: sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==} @@ -5016,9 +5097,6 @@ packages: '@types/mime@3.0.4': resolution: {integrity: sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw==} - '@types/mocha@9.1.1': - resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} - '@types/ms@0.7.31': resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} @@ -5226,18 +5304,48 @@ packages: '@vitest/expect@0.34.6': resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} + '@vitest/expect@2.1.2': + resolution: {integrity: sha512-FEgtlN8mIUSEAAnlvn7mP8vzaWhEaAEvhSXCqrsijM7K6QqjB11qoRZYEd4AKSCDz8p0/+yH5LzhZ47qt+EyPg==} + + '@vitest/mocker@2.1.2': + resolution: {integrity: sha512-ExElkCGMS13JAJy+812fw1aCv2QO/LBK6CyO4WOPAzLTmve50gydOlWhgdBJPx2ztbADUq3JVI0C5U+bShaeEA==} + peerDependencies: + '@vitest/spy': 2.1.2 + msw: ^2.3.5 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@2.1.2': + resolution: {integrity: sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA==} + '@vitest/runner@0.34.6': resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} + '@vitest/runner@2.1.2': + resolution: {integrity: sha512-UCsPtvluHO3u7jdoONGjOSil+uON5SSvU9buQh3lP7GgUXHp78guN1wRmZDX4wGK6J10f9NUtP6pO+SFquoMlw==} + '@vitest/snapshot@0.34.6': resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} + '@vitest/snapshot@2.1.2': + resolution: {integrity: sha512-xtAeNsZ++aRIYIUsek7VHzry/9AcxeULlegBvsdLncLmNCR6tR8SRjn8BbDP4naxtccvzTqZ+L1ltZlRCfBZFA==} + '@vitest/spy@0.34.6': resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} + '@vitest/spy@2.1.2': + resolution: {integrity: sha512-GSUi5zoy+abNRJwmFhBDC0yRuVUn8WMlQscvnbbXdKLXX9dE59YbfwXxuJ/mth6eeqIzofU8BB5XDo/Ns/qK2A==} + '@vitest/utils@0.34.6': resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} + '@vitest/utils@2.1.2': + resolution: {integrity: sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==} + '@wagmi/connectors@5.1.10': resolution: {integrity: sha512-ybgKV09PIhgUgQ4atXTs2KOy4Hevd6f972SXfx6HTgsnFXlzxzN6o0aWjhavZOYjvx5tjuL3+8Mgqo0R7uP5Cg==} peerDependencies: @@ -5612,6 +5720,10 @@ packages: assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + ast-parents@0.0.1: resolution: {integrity: sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==} @@ -5874,6 +5986,10 @@ packages: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} + chai@5.1.1: + resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} + engines: {node: '>=12'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -5903,6 +6019,10 @@ packages: check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -6317,6 +6437,10 @@ packages: resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-equal@1.0.1: resolution: {integrity: sha512-bHtC0iYvWhyaTzvV3CZgPeZQqCOBGyGsVV7v4eevpdkLHfiSrXUdBG+qAuSz4RI70sszvjQ1QSZ98An1yNwpSw==} @@ -6875,6 +6999,9 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -6936,6 +7063,10 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} + execa@9.4.0: + resolution: {integrity: sha512-yKHlle2YGxZE842MERVIplWwNH5VYmqqcPFgtnlU//K8gxuFFXu0pwd/CrfXTumFpeEiufsP7+opT/bPJa1yVw==} + engines: {node: ^18.19.0 || >=20.5.0} + execcli@5.0.6: resolution: {integrity: sha512-du+uy/Ew2P90PKjSHI89u/XuqVaBDzvaJ6ePn40JaOy7owFQNsYDbd5AoR5A559HEAb1i5HO22rJxtgVonf5Bg==} engines: {node: '>=8', npm: '>=4'} @@ -7042,6 +7173,10 @@ packages: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} + figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} + file-entry-cache@5.0.1: resolution: {integrity: sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==} engines: {node: '>=4'} @@ -7267,6 +7402,10 @@ packages: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} + get-stream@9.0.1: + resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} + engines: {node: '>=18'} + get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -7481,6 +7620,10 @@ packages: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} + human-signals@8.0.0: + resolution: {integrity: sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA==} + engines: {node: '>=18.18.0'} + humanize-ms@1.2.1: resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} @@ -7770,6 +7913,10 @@ packages: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + is-stream@4.0.1: + resolution: {integrity: sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==} + engines: {node: '>=18'} + is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -7790,6 +7937,10 @@ packages: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + is-utf8@0.2.1: resolution: {integrity: sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==} @@ -8342,6 +8493,9 @@ packages: loupe@2.3.7: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + loupe@3.1.1: + resolution: {integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==} + lru-cache@10.3.0: resolution: {integrity: sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==} engines: {node: 14 || >=16.14} @@ -8674,6 +8828,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + napi-build-utils@1.0.2: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} @@ -8811,6 +8970,10 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + npm-run-path@6.0.0: + resolution: {integrity: sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==} + engines: {node: '>=18'} + npmlog@6.0.2: resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -9123,6 +9286,10 @@ packages: pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + peek-stream@1.1.3: resolution: {integrity: sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==} @@ -9132,6 +9299,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -9273,6 +9443,10 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.4.47: + resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} + engines: {node: ^10 || ^12 || >=14} + postgres@3.3.5: resolution: {integrity: sha512-+JD93VELV9gHkqpV5gdL5/70HdGtEw4/XE1S4BC8f1mcPmdib3K5XsKVbnR1XcAyC41zOnifJ+9YRKxdIsXiUw==} @@ -9866,6 +10040,11 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true + rollup@4.24.0: + resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} @@ -10131,6 +10310,10 @@ packages: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} @@ -10327,6 +10510,10 @@ packages: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} + strip-final-newline@4.0.0: + resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} + engines: {node: '>=18'} + strip-json-comments@2.0.1: resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} engines: {node: '>=0.10.0'} @@ -10503,14 +10690,29 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.0: + resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinypool@0.7.0: resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} engines: {node: '>=14.0.0'} + tinypool@1.0.1: + resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@1.2.0: + resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + engines: {node: '>=14.0.0'} + tinyspy@2.2.1: resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} engines: {node: '>=14.0.0'} + tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -10777,6 +10979,10 @@ packages: resolution: {integrity: sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==} engines: {node: '>=4'} + unicorn-magic@0.3.0: + resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} + engines: {node: '>=18'} + unique-filename@2.0.1: resolution: {integrity: sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -10956,6 +11162,11 @@ packages: engines: {node: '>=v14.18.0'} hasBin: true + vite-node@2.1.2: + resolution: {integrity: sha512-HPcGNN5g/7I2OtPjLqgOtCRu/qhVvBxTUD3qzitmL0SrG1cWFzxzhMDWussxSbrRYWqnKf8P2jiNhPMSN+ymsQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + vite@4.5.5: resolution: {integrity: sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -10984,6 +11195,37 @@ packages: terser: optional: true + vite@5.4.8: + resolution: {integrity: sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + vitest@0.34.6: resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} engines: {node: '>=v14.18.0'} @@ -11015,6 +11257,31 @@ packages: webdriverio: optional: true + vitest@2.1.2: + resolution: {integrity: sha512-veNjLizOMkRrJ6xxb+pvxN6/QAWg95mzcRjtmkepXdN87FNfxAss9RKe2far/G9cQpipfgP2taqg0KiWsquj8A==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 2.1.2 + '@vitest/ui': 2.1.2 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + vlq@1.0.1: resolution: {integrity: sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==} @@ -11293,6 +11560,10 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} + yoctocolors@2.1.1: + resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} + engines: {node: '>=18'} + zod-validation-error@1.3.0: resolution: {integrity: sha512-4WoQnuWnj06kwKR4A+cykRxFmy+CTvwMQO5ogTXLiVx1AuvYYmMjixh7sbkSsQTr1Fvtss6d5kVz8PGeMPUQjQ==} engines: {node: '>=16.0.0'} @@ -13751,7 +14022,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/resolve-uri@3.1.0': {} @@ -13779,7 +14050,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@koa/cors@4.0.0': dependencies: @@ -13911,7 +14182,7 @@ snapshots: react-dom: 18.2.0(react@18.2.0) react-native: 0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10) - '@metamask/sdk@0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(utf-8-validate@5.0.10)': + '@metamask/sdk@0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(utf-8-validate@5.0.10)': dependencies: '@metamask/onboarding': 1.0.1 '@metamask/providers': 16.1.0 @@ -13932,7 +14203,7 @@ snapshots: qrcode-terminal-nooctal: 0.12.1 react-native-webview: 11.26.1(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0) readable-stream: 3.6.2 - rollup-plugin-visualizer: 5.12.0(rollup@3.29.4) + rollup-plugin-visualizer: 5.12.0(rollup@4.24.0) socket.io-client: 4.7.5(bufferutil@4.0.8)(utf-8-validate@5.0.10) util: 0.12.5 uuid: 8.3.2 @@ -13963,8 +14234,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -13977,8 +14248,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -14991,7 +15262,7 @@ snapshots: '@types/react': 18.2.22 '@types/react-dom': 18.2.7 - '@rainbow-me/rainbowkit@2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))': + '@rainbow-me/rainbowkit@2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))': dependencies: '@tanstack/react-query': 5.52.0(react@18.2.0) '@vanilla-extract/css': 1.15.5 @@ -15004,7 +15275,7 @@ snapshots: react-remove-scroll: 2.6.0(@types/react@18.2.22)(react@18.2.0) ua-parser-js: 1.0.38 viem: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) - wagmi: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + wagmi: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) transitivePeerDependencies: - '@types/react' - babel-plugin-macros @@ -15313,6 +15584,54 @@ snapshots: '@remix-run/router@1.6.0': {} + '@rollup/rollup-android-arm-eabi@4.24.0': + optional: true + + '@rollup/rollup-android-arm64@4.24.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.24.0': + optional: true + + '@rollup/rollup-darwin-x64@4.24.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.24.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.24.0': + optional: true + + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.24.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.24.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.24.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.24.0': + optional: true + '@rushstack/eslint-patch@1.10.4': {} '@safe-global/safe-apps-provider@0.18.3(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)': @@ -15337,26 +15656,26 @@ snapshots: '@safe-global/safe-gateway-typescript-sdk@3.22.2': {} - '@scure/base@1.1.6': {} - '@scure/base@1.1.8': {} '@scure/bip32@1.4.0': dependencies: '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.3.0': dependencies: '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.4.0': dependencies: '@noble/hashes': 1.5.0 '@scure/base': 1.1.8 + '@sec-ant/readable-stream@0.4.1': {} + '@sentry-internal/tracing@7.86.0': dependencies: '@sentry/core': 7.86.0 @@ -15416,6 +15735,8 @@ snapshots: '@sinclair/typebox@0.27.8': {} + '@sindresorhus/merge-streams@4.0.0': {} + '@sinonjs/commons@2.0.0': dependencies: type-detect: 4.0.8 @@ -15934,6 +16255,8 @@ snapshots: '@types/emscripten@1.39.6': {} + '@types/estree@1.0.6': {} + '@types/express-serve-static-core@4.17.41': dependencies: '@types/node': 18.19.50 @@ -16014,8 +16337,6 @@ snapshots: '@types/mime@3.0.4': {} - '@types/mocha@9.1.1': {} - '@types/ms@0.7.31': {} '@types/node-forge@1.3.11': @@ -16278,17 +16599,6 @@ snapshots: - debug - utf-8-validate - '@viem/anvil@0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10)': - dependencies: - execa: 7.2.0 - get-port: 6.1.2 - http-proxy: 1.18.1(debug@4.3.7) - ws: 8.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - debug - - utf-8-validate - '@vitejs/plugin-react@4.3.1(vite@4.5.5(@types/node@20.12.12)(terser@5.33.0))': dependencies: '@babel/core': 7.25.2 @@ -16306,32 +16616,72 @@ snapshots: '@vitest/utils': 0.34.6 chai: 4.5.0 + '@vitest/expect@2.1.2': + dependencies: + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 + chai: 5.1.1 + tinyrainbow: 1.2.0 + + '@vitest/mocker@2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@18.15.11)(terser@5.33.0))': + dependencies: + '@vitest/spy': 2.1.2 + estree-walker: 3.0.3 + magic-string: 0.30.11 + optionalDependencies: + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + + '@vitest/pretty-format@2.1.2': + dependencies: + tinyrainbow: 1.2.0 + '@vitest/runner@0.34.6': dependencies: '@vitest/utils': 0.34.6 p-limit: 4.0.0 pathe: 1.1.2 + '@vitest/runner@2.1.2': + dependencies: + '@vitest/utils': 2.1.2 + pathe: 1.1.2 + '@vitest/snapshot@0.34.6': dependencies: magic-string: 0.30.11 pathe: 1.1.2 pretty-format: 29.7.0 + '@vitest/snapshot@2.1.2': + dependencies: + '@vitest/pretty-format': 2.1.2 + magic-string: 0.30.11 + pathe: 1.1.2 + '@vitest/spy@0.34.6': dependencies: tinyspy: 2.2.1 + '@vitest/spy@2.1.2': + dependencies: + tinyspy: 3.0.2 + '@vitest/utils@0.34.6': dependencies: diff-sequences: 29.6.3 loupe: 2.3.7 pretty-format: 29.7.0 - '@wagmi/connectors@5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': + '@vitest/utils@2.1.2': + dependencies: + '@vitest/pretty-format': 2.1.2 + loupe: 3.1.1 + tinyrainbow: 1.2.0 + + '@wagmi/connectors@5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': dependencies: '@coinbase/wallet-sdk': 4.0.4 - '@metamask/sdk': 0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(utf-8-validate@5.0.10) + '@metamask/sdk': 0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) '@wagmi/core': 2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)) @@ -16985,6 +17335,8 @@ snapshots: assertion-error@1.1.0: {} + assertion-error@2.0.1: {} + ast-parents@0.0.1: {} ast-types-flow@0.0.8: {} @@ -17344,6 +17696,14 @@ snapshots: pathval: 1.1.1 type-detect: 4.1.0 + chai@5.1.1: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.1 + pathval: 2.0.0 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -17369,6 +17729,8 @@ snapshots: dependencies: get-func-name: 2.0.2 + check-error@2.1.1: {} + chokidar@3.5.3: dependencies: anymatch: 3.1.3 @@ -17794,6 +18156,8 @@ snapshots: dependencies: type-detect: 4.1.0 + deep-eql@5.0.2: {} + deep-equal@1.0.1: {} deep-equal@2.2.3: @@ -18601,6 +18965,10 @@ snapshots: estraverse@5.3.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.6 + esutils@2.0.3: {} etag@1.8.1: {} @@ -18702,6 +19070,21 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 + execa@9.4.0: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.3 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 8.0.0 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 6.0.0 + pretty-ms: 9.1.0 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.1.1 + execcli@5.0.6: dependencies: argx: 4.0.4 @@ -18837,6 +19220,10 @@ snapshots: dependencies: escape-string-regexp: 1.0.5 + figures@6.1.0: + dependencies: + is-unicode-supported: 2.1.0 + file-entry-cache@5.0.1: dependencies: flat-cache: 2.0.1 @@ -18936,10 +19323,6 @@ snapshots: optionalDependencies: debug: 4.3.4 - follow-redirects@1.15.2(debug@4.3.7): - optionalDependencies: - debug: 4.3.7 - for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -19062,6 +19445,11 @@ snapshots: get-stream@8.0.1: {} + get-stream@9.0.1: + dependencies: + '@sec-ant/readable-stream': 0.4.1 + is-stream: 4.0.1 + get-symbol-description@1.0.0: dependencies: call-bind: 1.0.2 @@ -19314,14 +19702,6 @@ snapshots: transitivePeerDependencies: - debug - http-proxy@1.18.1(debug@4.3.7): - dependencies: - eventemitter3: 4.0.7 - follow-redirects: 1.15.2(debug@4.3.7) - requires-port: 1.0.0 - transitivePeerDependencies: - - debug - http-shutdown@1.2.2: {} https-proxy-agent@5.0.1: @@ -19339,6 +19719,8 @@ snapshots: human-signals@5.0.0: {} + human-signals@8.0.0: {} + humanize-ms@1.2.1: dependencies: ms: 2.1.3 @@ -19602,6 +19984,8 @@ snapshots: is-stream@3.0.0: {} + is-stream@4.0.1: {} + is-string@1.0.7: dependencies: has-tostringtag: 1.0.0 @@ -19620,6 +20004,8 @@ snapshots: is-unicode-supported@0.1.0: {} + is-unicode-supported@2.1.0: {} + is-utf8@0.2.1: {} is-weakmap@2.0.2: {} @@ -20546,6 +20932,10 @@ snapshots: dependencies: get-func-name: 2.0.2 + loupe@3.1.1: + dependencies: + get-func-name: 2.0.2 + lru-cache@10.3.0: {} lru-cache@10.4.3: {} @@ -20980,6 +21370,8 @@ snapshots: nanoid@3.3.6: {} + nanoid@3.3.7: {} + napi-build-utils@1.0.2: {} natural-compare@1.4.0: {} @@ -21103,6 +21495,11 @@ snapshots: dependencies: path-key: 4.0.0 + npm-run-path@6.0.0: + dependencies: + path-key: 4.0.0 + unicorn-magic: 0.3.0 + npmlog@6.0.2: dependencies: are-we-there-yet: 3.0.1 @@ -21425,6 +21822,8 @@ snapshots: pathval@1.1.1: {} + pathval@2.0.0: {} + peek-stream@1.1.3: dependencies: buffer-from: 1.1.2 @@ -21435,6 +21834,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.0: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -21538,12 +21939,12 @@ snapshots: optionalDependencies: postcss: 8.4.23 - postcss-load-config@3.1.4(postcss@8.4.31): + postcss-load-config@3.1.4(postcss@8.4.47): dependencies: lilconfig: 2.1.0 yaml: 1.10.2 optionalDependencies: - postcss: 8.4.31 + postcss: 8.4.47 postcss-load-config@4.0.1(postcss@8.4.23): dependencies: @@ -21576,6 +21977,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.0.2 + postcss@8.4.47: + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.0 + source-map-js: 1.2.1 + postgres@3.3.5: {} preact@10.23.2: {} @@ -22149,14 +22556,14 @@ snapshots: dependencies: glob: 7.2.3 - rollup-plugin-visualizer@5.12.0(rollup@3.29.4): + rollup-plugin-visualizer@5.12.0(rollup@4.24.0): dependencies: open: 8.4.2 picomatch: 2.3.1 source-map: 0.7.4 yargs: 17.7.2 optionalDependencies: - rollup: 3.29.4 + rollup: 4.24.0 rollup@3.21.8: optionalDependencies: @@ -22166,6 +22573,28 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + rollup@4.24.0: + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.24.0 + '@rollup/rollup-android-arm64': 4.24.0 + '@rollup/rollup-darwin-arm64': 4.24.0 + '@rollup/rollup-darwin-x64': 4.24.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.0 + '@rollup/rollup-linux-arm-musleabihf': 4.24.0 + '@rollup/rollup-linux-arm64-gnu': 4.24.0 + '@rollup/rollup-linux-arm64-musl': 4.24.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.0 + '@rollup/rollup-linux-riscv64-gnu': 4.24.0 + '@rollup/rollup-linux-s390x-gnu': 4.24.0 + '@rollup/rollup-linux-x64-gnu': 4.24.0 + '@rollup/rollup-linux-x64-musl': 4.24.0 + '@rollup/rollup-win32-arm64-msvc': 4.24.0 + '@rollup/rollup-win32-ia32-msvc': 4.24.0 + '@rollup/rollup-win32-x64-msvc': 4.24.0 + fsevents: 2.3.3 + rrweb-cssom@0.6.0: {} run-async@2.4.1: {} @@ -22484,6 +22913,8 @@ snapshots: source-map-js@1.0.2: {} + source-map-js@1.2.1: {} + source-map-support@0.5.13: dependencies: buffer-from: 1.1.2 @@ -22698,6 +23129,8 @@ snapshots: strip-final-newline@3.0.0: {} + strip-final-newline@4.0.0: {} + strip-json-comments@2.0.1: {} strip-json-comments@3.1.1: {} @@ -22922,10 +23355,18 @@ snapshots: tinybench@2.9.0: {} + tinyexec@0.3.0: {} + tinypool@0.7.0: {} + tinypool@1.0.1: {} + + tinyrainbow@1.2.0: {} + tinyspy@2.2.1: {} + tinyspy@3.0.2: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -23048,7 +23489,7 @@ snapshots: - supports-color - ts-node - tsup@6.7.0(postcss@8.4.31)(typescript@5.4.2): + tsup@6.7.0(postcss@8.4.47)(typescript@5.4.2): dependencies: bundle-require: 4.0.1(esbuild@0.17.17) cac: 6.7.14 @@ -23058,14 +23499,14 @@ snapshots: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 3.1.4(postcss@8.4.31) + postcss-load-config: 3.1.4(postcss@8.4.47) resolve-from: 5.0.0 rollup: 3.21.8 source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 optionalDependencies: - postcss: 8.4.31 + postcss: 8.4.47 typescript: 5.4.2 transitivePeerDependencies: - supports-color @@ -23221,6 +23662,8 @@ snapshots: unicode-property-aliases-ecmascript@2.1.0: {} + unicorn-magic@0.3.0: {} + unique-filename@2.0.1: dependencies: unique-slug: 3.0.0 @@ -23381,6 +23824,23 @@ snapshots: - supports-color - terser + vite-node@2.1.2(@types/node@18.15.11)(terser@5.33.0): + dependencies: + cac: 6.7.14 + debug: 4.3.7 + pathe: 1.1.2 + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite@4.5.5(@types/node@18.19.50)(terser@5.33.0): dependencies: esbuild: 0.18.20 @@ -23401,7 +23861,17 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): + vite@5.4.8(@types/node@18.15.11)(terser@5.33.0): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.47 + rollup: 4.24.0 + optionalDependencies: + '@types/node': 18.15.11 + fsevents: 2.3.3 + terser: 5.33.0 + + vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5 @@ -23438,16 +23908,51 @@ snapshots: - supports-color - terser + vitest@2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): + dependencies: + '@vitest/expect': 2.1.2 + '@vitest/mocker': 2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@18.15.11)(terser@5.33.0)) + '@vitest/pretty-format': 2.1.2 + '@vitest/runner': 2.1.2 + '@vitest/snapshot': 2.1.2 + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 + chai: 5.1.1 + debug: 4.3.7 + magic-string: 0.30.11 + pathe: 1.1.2 + std-env: 3.7.0 + tinybench: 2.9.0 + tinyexec: 0.3.0 + tinypool: 1.0.1 + tinyrainbow: 1.2.0 + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + vite-node: 2.1.2(@types/node@18.15.11)(terser@5.33.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 18.15.11 + jsdom: 22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vlq@1.0.1: {} w3c-xmlserializer@4.0.0: dependencies: xml-name-validator: 4.0.0 - wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.52.0(react@18.2.0) - '@wagmi/connectors': 5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/connectors': 5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) '@wagmi/core': 2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) @@ -23492,7 +23997,7 @@ snapshots: webauthn-p256@0.0.5: dependencies: '@noble/curves': 1.4.2 - '@noble/hashes': 1.4.0 + '@noble/hashes': 1.5.0 webextension-polyfill@0.10.0: {} @@ -23766,6 +24271,8 @@ snapshots: yocto-queue@1.0.0: {} + yoctocolors@2.1.1: {} + zod-validation-error@1.3.0(zod@3.23.8): dependencies: zod: 3.23.8 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 07248c79f9..6f2a1dc3f7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,6 +1,7 @@ packages: - packages/* - - test/* + - test/mock-game-contracts + - test/ts-benchmarks catalog: "@ark/attest": "0.12.1" diff --git a/packages/store/ts/test/setup.ts b/test-setup/anvil.ts similarity index 100% rename from packages/store/ts/test/setup.ts rename to test-setup/anvil.ts diff --git a/packages/store/ts/test/common.ts b/test-setup/common.ts similarity index 73% rename from packages/store/ts/test/common.ts rename to test-setup/common.ts index 8fb19fbef2..5f24cf4266 100644 --- a/packages/store/ts/test/common.ts +++ b/test-setup/common.ts @@ -14,3 +14,10 @@ export const testClient = createTestClient({ transport: http(anvilRpcUrl), pollingInterval: 10, }); + +export async function snapshotAnvilState() { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +} diff --git a/packages/store/ts/test/globalSetup.ts b/test-setup/global/anvil.ts similarity index 79% rename from packages/store/ts/test/globalSetup.ts rename to test-setup/global/anvil.ts index f1594c0483..f424fc5b0a 100644 --- a/packages/store/ts/test/globalSetup.ts +++ b/test-setup/global/anvil.ts @@ -1,11 +1,11 @@ import { startProxy as startAnvilProxy } from "@viem/anvil"; -import { anvilHost, anvilPort } from "./common"; +import { anvilHost, anvilPort } from "../common"; import { execa } from "execa"; export default async function globalSetup(): Promise<() => Promise> { console.log("building mock game"); await execa("pnpm", ["run", "build"], { - cwd: `${__dirname}/../../../../test/mock-game-contracts`, + cwd: `${__dirname}/../../test/mock-game-contracts`, }); const shutdownAnvilProxy = await startAnvilProxy({ diff --git a/packages/store/vitestSetup.ts b/test-setup/global/arktype.ts similarity index 100% rename from packages/store/vitestSetup.ts rename to test-setup/global/arktype.ts diff --git a/packages/store/ts/test/mockGame.ts b/test-setup/mockGame.ts similarity index 83% rename from packages/store/ts/test/mockGame.ts rename to test-setup/mockGame.ts index 3db0279503..e76172a1a5 100644 --- a/packages/store/ts/test/mockGame.ts +++ b/test-setup/mockGame.ts @@ -1,8 +1,8 @@ import { execa } from "execa"; import { anvilRpcUrl } from "./common"; import { Hex, isHex } from "viem"; -import config from "../../../../test/mock-game-contracts/mud.config"; -import worldAbi from "../../../../test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; +import config from "../test/mock-game-contracts/mud.config"; +import worldAbi from "../test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; export { config, worldAbi }; @@ -14,7 +14,7 @@ export async function deployMockGame(): Promise { // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], { - cwd: `${__dirname}/../../../../test/mock-game-contracts`, + cwd: `${__dirname}/../test/mock-game-contracts`, env: { // anvil default account PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", diff --git a/packages/store/vitest.config.ts b/vitest.config.ts similarity index 66% rename from packages/store/vitest.config.ts rename to vitest.config.ts index c1a0c3a874..f0ed65772f 100644 --- a/packages/store/vitest.config.ts +++ b/vitest.config.ts @@ -2,8 +2,8 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - globalSetup: ["vitestSetup.ts", "ts/test/globalSetup.ts"], - setupFiles: ["ts/test/setup.ts"], + globalSetup: [`${__dirname}/test-setup/global/arktype.ts`, `${__dirname}/test-setup/global/anvil.ts`], + setupFiles: [`${__dirname}/test-setup/anvil.ts`], // Temporarily set a low teardown timeout because anvil hangs otherwise // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 teardownTimeout: 500, @@ -12,7 +12,7 @@ export default defineConfig({ server: { watch: { // we build+import this file in test setup, which causes vitest to restart in a loop unless we ignore it here - ignored: ["**/test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"], + ignored: ["**/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"], }, }, }); From de222dd0ac8e9b998f27bc67807d2135f17aff98 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:04:26 +0100 Subject: [PATCH 21/32] test: move store ts tests to root --- .gitignore | 4 +- package.json | 7 +- packages/config/src/exports/internal.ts | 1 + packages/store/package.json | 4 +- packages/store/ts/protocolVersions.test.ts | 4 +- packages/store/vitest.config.ts | 7 - packages/world-modules/package.json | 1 - packages/world/package.json | 1 - pnpm-lock.yaml | 680 ++++++++++++++++-- pnpm-workspace.yaml | 3 +- test-setup/anvil.ts | 18 + test-setup/common.ts | 23 + test-setup/global/anvil.ts | 19 + .../global/arktype.ts | 0 test-setup/mockGame.ts | 35 + vitest.config.ts | 18 + 16 files changed, 738 insertions(+), 87 deletions(-) delete mode 100644 packages/store/vitest.config.ts create mode 100644 test-setup/anvil.ts create mode 100644 test-setup/common.ts create mode 100644 test-setup/global/anvil.ts rename packages/store/vitestSetup.ts => test-setup/global/arktype.ts (100%) create mode 100644 test-setup/mockGame.ts create mode 100644 vitest.config.ts diff --git a/.gitignore b/.gitignore index 92fad4b3ce..610cfff0db 100644 --- a/.gitignore +++ b/.gitignore @@ -5,11 +5,11 @@ node_modules package-lock.json yarn.lock +*.log + .eslintcache .parcel-cache .docs -lerna-debug.log -yarn-error.log .turbo .attest .tstrace diff --git a/package.json b/package.json index bf62be8e93..a233f5069e 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,10 @@ "@types/node": "^18.15.11", "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.1", + "@viem/anvil": "^0.0.7", "chalk": "^5.2.0", "eslint": "8.57.0", - "execa": "^7.0.0", + "execa": "^9.4.0", "glob": "^10.4.2", "husky": ">=6", "lint-staged": "^15.2.10", @@ -54,7 +55,9 @@ "sort-package-json": "^2.10.1", "tsx": "4.16.2", "turbo": "^1.9.3", - "typescript": "5.4.2" + "typescript": "5.4.2", + "viem": "catalog:", + "vitest": "2.1.2" }, "packageManager": "pnpm@9.6.0", "engines": { diff --git a/packages/config/src/exports/internal.ts b/packages/config/src/exports/internal.ts index e69de29bb2..bf20023148 100644 --- a/packages/config/src/exports/internal.ts +++ b/packages/config/src/exports/internal.ts @@ -0,0 +1 @@ +// Nothing here yet. diff --git a/packages/store/package.json b/packages/store/package.json index f5fb1ade64..92cfbdefe5 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -72,13 +72,11 @@ "@latticexyz/abi-ts": "workspace:*", "@latticexyz/gas-report": "workspace:*", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", "solhint": "^3.3.7", "tsup": "^6.7.0", - "tsx": "^3.12.6", - "vitest": "0.34.6" + "tsx": "^3.12.6" } } diff --git a/packages/store/ts/protocolVersions.test.ts b/packages/store/ts/protocolVersions.test.ts index 5ea35f76be..d8072469db 100644 --- a/packages/store/ts/protocolVersions.test.ts +++ b/packages/store/ts/protocolVersions.test.ts @@ -19,7 +19,9 @@ import { protocolVersions } from "./protocolVersions"; const [, currentVersion] = fs.readFileSync(`${__dirname}/../src/version.sol`, "utf8").match(/VERSION = "(.*?)"/) ?? []; -const currentAbi = formatAbi(StoreAbi).sort((a, b) => a.localeCompare(b)); +const currentAbi = formatAbi(StoreAbi) + .slice() + .sort((a, b) => a.localeCompare(b)); describe("Store protocol version", () => { it("is up to date", async () => { diff --git a/packages/store/vitest.config.ts b/packages/store/vitest.config.ts deleted file mode 100644 index b6a66f2a98..0000000000 --- a/packages/store/vitest.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from "vitest/config"; - -export default defineConfig({ - test: { - globalSetup: "vitestSetup.ts", - }, -}); diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index 9134915252..f97180763b 100644 --- a/packages/world-modules/package.json +++ b/packages/world-modules/package.json @@ -54,7 +54,6 @@ "@latticexyz/cli": "workspace:*", "@latticexyz/gas-report": "workspace:*", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", diff --git a/packages/world/package.json b/packages/world/package.json index da358eacc4..5442d5d7a8 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -75,7 +75,6 @@ "@latticexyz/gas-report": "workspace:*", "@types/debug": "^4.1.7", "@types/ejs": "^3.1.1", - "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "ejs": "^3.1.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 571ea0d785..9a1ed1cc35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,6 +35,9 @@ importers: '@typescript-eslint/parser': specifier: 7.1.1 version: 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@viem/anvil': + specifier: ^0.0.7 + version: 0.0.7(bufferutil@4.0.8)(debug@4.3.4)(utf-8-validate@5.0.10) chalk: specifier: ^5.2.0 version: 5.2.0 @@ -42,8 +45,8 @@ importers: specifier: 8.57.0 version: 8.57.0 execa: - specifier: ^7.0.0 - version: 7.0.0 + specifier: ^9.4.0 + version: 9.4.0 glob: specifier: ^10.4.2 version: 10.4.2 @@ -74,6 +77,12 @@ importers: typescript: specifier: 5.4.2 version: 5.4.2 + viem: + specifier: 'catalog:' + version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) + vitest: + specifier: 2.1.2 + version: 2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/abi-ts: dependencies: @@ -104,7 +113,7 @@ importers: version: 17.0.23 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -132,7 +141,7 @@ importers: version: 4.1.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -271,7 +280,7 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -326,7 +335,7 @@ importers: version: 0.0.7(bufferutil@4.0.8)(debug@4.3.4)(utf-8-validate@5.0.10) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -354,7 +363,7 @@ importers: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/create-mud: dependencies: @@ -367,7 +376,7 @@ importers: version: 18.15.11 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/dev-tools: dependencies: @@ -500,7 +509,7 @@ importers: version: 3.1.3(@types/react-dom@18.2.7)(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@rainbow-me/rainbowkit': specifier: ^2.1.5 - version: 2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)) + version: 2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)) '@tanstack/react-query': specifier: ^5.51.3 version: 5.52.0(react@18.2.0) @@ -560,7 +569,7 @@ importers: version: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) wagmi: specifier: 'catalog:' - version: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + version: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) yargs: specifier: ^17.7.1 version: 17.7.2 @@ -652,7 +661,7 @@ importers: version: 4.1.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -701,7 +710,7 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -726,7 +735,7 @@ importers: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -775,7 +784,7 @@ importers: version: 18.2.0(react@18.2.0) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vite: specifier: ^4.3.6 version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) @@ -812,7 +821,7 @@ importers: version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) type-fest: specifier: ^2.14.0 version: 2.14.0 @@ -837,7 +846,7 @@ importers: version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -846,7 +855,7 @@ importers: devDependencies: tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/solhint-plugin-mud: dependencies: @@ -859,7 +868,7 @@ importers: version: 18.15.11 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/stash: dependencies: @@ -902,7 +911,7 @@ importers: version: 18.2.0(react@18.2.0) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -943,9 +952,6 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -960,13 +966,16 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 +<<<<<<< HEAD vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) +======= +>>>>>>> 908c0e600 (move store ts test to monorepo root) packages/store-indexer: dependencies: @@ -1075,7 +1084,7 @@ importers: version: 8.2.2 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -1175,7 +1184,7 @@ importers: version: link:../../test/mock-game-contracts tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) vitest: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) @@ -1203,7 +1212,7 @@ importers: version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) packages/world: dependencies: @@ -1250,9 +1259,6 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -1273,7 +1279,7 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -1313,7 +1319,7 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -1354,9 +1360,6 @@ importers: '@types/ejs': specifier: ^3.1.1 version: 3.1.1 - '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -1374,7 +1377,7 @@ importers: version: 3.3.7 tsup: specifier: ^6.7.0 - version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) + version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) tsx: specifier: ^3.12.6 version: 3.12.6 @@ -4490,6 +4493,86 @@ packages: resolution: {integrity: sha512-N13NRw3T2+6Xi9J//3CGLsK2OqC8NMme3d/YX+nh05K9YHWGcv8DycHJrqGScSP4T75o8IN6nqIMhVFU8ohg8w==} engines: {node: '>=14'} + '@rollup/rollup-android-arm-eabi@4.24.0': + resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.24.0': + resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.24.0': + resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.24.0': + resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.24.0': + resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.24.0': + resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.24.0': + resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.24.0': + resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.24.0': + resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.24.0': + resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.24.0': + resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-win32-arm64-msvc@4.24.0': + resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.24.0': + resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.24.0': + resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} + cpu: [x64] + os: [win32] + '@rushstack/eslint-patch@1.10.4': resolution: {integrity: sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==} @@ -4503,9 +4586,6 @@ packages: resolution: {integrity: sha512-Y0yAxRaB98LFp2Dm+ACZqBSdAmI3FlpH/LjxOZ94g/ouuDJecSq0iR26XZ5QDuEL8Rf+L4jBJaoDC08CD0KkJw==} engines: {node: '>=16'} - '@scure/base@1.1.6': - resolution: {integrity: sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==} - '@scure/base@1.1.8': resolution: {integrity: sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==} @@ -4518,6 +4598,9 @@ packages: '@scure/bip39@1.4.0': resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} + '@sec-ant/readable-stream@0.4.1': + resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + '@sentry-internal/tracing@7.86.0': resolution: {integrity: sha512-b4dUsNWlPWRwakGwR7bhOkqiFlqQszH1hhVFwrm/8s3kqEBZ+E4CeIfCvuHBHQ1cM/fx55xpXX/BU163cy+3iQ==} engines: {node: '>=8'} @@ -4562,6 +4645,10 @@ packages: '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + '@sinonjs/commons@2.0.0': resolution: {integrity: sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==} @@ -4932,6 +5019,9 @@ packages: '@types/emscripten@1.39.6': resolution: {integrity: sha512-H90aoynNhhkQP6DRweEjJp5vfUVdIj7tdPLsu7pq89vODD/lcugKfZOsfgwpvM6XUewEp2N5dCg1Uf3Qe55Dcg==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/express-serve-static-core@4.17.41': resolution: {integrity: sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==} @@ -4995,9 +5085,6 @@ packages: '@types/mime@3.0.4': resolution: {integrity: sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw==} - '@types/mocha@9.1.1': - resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} - '@types/ms@0.7.31': resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} @@ -5205,18 +5292,48 @@ packages: '@vitest/expect@0.34.6': resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} + '@vitest/expect@2.1.2': + resolution: {integrity: sha512-FEgtlN8mIUSEAAnlvn7mP8vzaWhEaAEvhSXCqrsijM7K6QqjB11qoRZYEd4AKSCDz8p0/+yH5LzhZ47qt+EyPg==} + + '@vitest/mocker@2.1.2': + resolution: {integrity: sha512-ExElkCGMS13JAJy+812fw1aCv2QO/LBK6CyO4WOPAzLTmve50gydOlWhgdBJPx2ztbADUq3JVI0C5U+bShaeEA==} + peerDependencies: + '@vitest/spy': 2.1.2 + msw: ^2.3.5 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@2.1.2': + resolution: {integrity: sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA==} + '@vitest/runner@0.34.6': resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} + '@vitest/runner@2.1.2': + resolution: {integrity: sha512-UCsPtvluHO3u7jdoONGjOSil+uON5SSvU9buQh3lP7GgUXHp78guN1wRmZDX4wGK6J10f9NUtP6pO+SFquoMlw==} + '@vitest/snapshot@0.34.6': resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} + '@vitest/snapshot@2.1.2': + resolution: {integrity: sha512-xtAeNsZ++aRIYIUsek7VHzry/9AcxeULlegBvsdLncLmNCR6tR8SRjn8BbDP4naxtccvzTqZ+L1ltZlRCfBZFA==} + '@vitest/spy@0.34.6': resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} + '@vitest/spy@2.1.2': + resolution: {integrity: sha512-GSUi5zoy+abNRJwmFhBDC0yRuVUn8WMlQscvnbbXdKLXX9dE59YbfwXxuJ/mth6eeqIzofU8BB5XDo/Ns/qK2A==} + '@vitest/utils@0.34.6': resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} + '@vitest/utils@2.1.2': + resolution: {integrity: sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==} + '@wagmi/connectors@5.1.10': resolution: {integrity: sha512-ybgKV09PIhgUgQ4atXTs2KOy4Hevd6f972SXfx6HTgsnFXlzxzN6o0aWjhavZOYjvx5tjuL3+8Mgqo0R7uP5Cg==} peerDependencies: @@ -5591,6 +5708,10 @@ packages: assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + ast-parents@0.0.1: resolution: {integrity: sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==} @@ -5853,6 +5974,10 @@ packages: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} + chai@5.1.1: + resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} + engines: {node: '>=12'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -5882,6 +6007,10 @@ packages: check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -6296,6 +6425,10 @@ packages: resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-equal@1.0.1: resolution: {integrity: sha512-bHtC0iYvWhyaTzvV3CZgPeZQqCOBGyGsVV7v4eevpdkLHfiSrXUdBG+qAuSz4RI70sszvjQ1QSZ98An1yNwpSw==} @@ -6854,6 +6987,9 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -6915,6 +7051,10 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} + execa@9.4.0: + resolution: {integrity: sha512-yKHlle2YGxZE842MERVIplWwNH5VYmqqcPFgtnlU//K8gxuFFXu0pwd/CrfXTumFpeEiufsP7+opT/bPJa1yVw==} + engines: {node: ^18.19.0 || >=20.5.0} + execcli@5.0.6: resolution: {integrity: sha512-du+uy/Ew2P90PKjSHI89u/XuqVaBDzvaJ6ePn40JaOy7owFQNsYDbd5AoR5A559HEAb1i5HO22rJxtgVonf5Bg==} engines: {node: '>=8', npm: '>=4'} @@ -7021,6 +7161,10 @@ packages: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} + figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} + file-entry-cache@5.0.1: resolution: {integrity: sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==} engines: {node: '>=4'} @@ -7246,6 +7390,10 @@ packages: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} + get-stream@9.0.1: + resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} + engines: {node: '>=18'} + get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -7460,6 +7608,10 @@ packages: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} + human-signals@8.0.0: + resolution: {integrity: sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA==} + engines: {node: '>=18.18.0'} + humanize-ms@1.2.1: resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} @@ -7749,6 +7901,10 @@ packages: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + is-stream@4.0.1: + resolution: {integrity: sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==} + engines: {node: '>=18'} + is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -7769,6 +7925,10 @@ packages: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + is-utf8@0.2.1: resolution: {integrity: sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==} @@ -8321,6 +8481,9 @@ packages: loupe@2.3.7: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + loupe@3.1.1: + resolution: {integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==} + lru-cache@10.3.0: resolution: {integrity: sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==} engines: {node: 14 || >=16.14} @@ -8653,6 +8816,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + napi-build-utils@1.0.2: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} @@ -8790,6 +8958,10 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + npm-run-path@6.0.0: + resolution: {integrity: sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==} + engines: {node: '>=18'} + npmlog@6.0.2: resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -9102,6 +9274,10 @@ packages: pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + peek-stream@1.1.3: resolution: {integrity: sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==} @@ -9111,6 +9287,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -9252,6 +9431,10 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.4.47: + resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} + engines: {node: ^10 || ^12 || >=14} + postgres@3.3.5: resolution: {integrity: sha512-+JD93VELV9gHkqpV5gdL5/70HdGtEw4/XE1S4BC8f1mcPmdib3K5XsKVbnR1XcAyC41zOnifJ+9YRKxdIsXiUw==} @@ -9845,6 +10028,11 @@ packages: engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true + rollup@4.24.0: + resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} @@ -10110,6 +10298,10 @@ packages: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} @@ -10306,6 +10498,10 @@ packages: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} + strip-final-newline@4.0.0: + resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} + engines: {node: '>=18'} + strip-json-comments@2.0.1: resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} engines: {node: '>=0.10.0'} @@ -10482,14 +10678,29 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.0: + resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinypool@0.7.0: resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} engines: {node: '>=14.0.0'} + tinypool@1.0.1: + resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@1.2.0: + resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + engines: {node: '>=14.0.0'} + tinyspy@2.2.1: resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} engines: {node: '>=14.0.0'} + tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -10756,6 +10967,10 @@ packages: resolution: {integrity: sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==} engines: {node: '>=4'} + unicorn-magic@0.3.0: + resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} + engines: {node: '>=18'} + unique-filename@2.0.1: resolution: {integrity: sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -10935,6 +11150,11 @@ packages: engines: {node: '>=v14.18.0'} hasBin: true + vite-node@2.1.2: + resolution: {integrity: sha512-HPcGNN5g/7I2OtPjLqgOtCRu/qhVvBxTUD3qzitmL0SrG1cWFzxzhMDWussxSbrRYWqnKf8P2jiNhPMSN+ymsQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + vite@4.5.5: resolution: {integrity: sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -10963,6 +11183,37 @@ packages: terser: optional: true + vite@5.4.8: + resolution: {integrity: sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + vitest@0.34.6: resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} engines: {node: '>=v14.18.0'} @@ -10994,6 +11245,31 @@ packages: webdriverio: optional: true + vitest@2.1.2: + resolution: {integrity: sha512-veNjLizOMkRrJ6xxb+pvxN6/QAWg95mzcRjtmkepXdN87FNfxAss9RKe2far/G9cQpipfgP2taqg0KiWsquj8A==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 2.1.2 + '@vitest/ui': 2.1.2 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + vlq@1.0.1: resolution: {integrity: sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==} @@ -11272,6 +11548,10 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} + yoctocolors@2.1.1: + resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} + engines: {node: '>=18'} + zod-validation-error@1.3.0: resolution: {integrity: sha512-4WoQnuWnj06kwKR4A+cykRxFmy+CTvwMQO5ogTXLiVx1AuvYYmMjixh7sbkSsQTr1Fvtss6d5kVz8PGeMPUQjQ==} engines: {node: '>=16.0.0'} @@ -13730,7 +14010,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/resolve-uri@3.1.0': {} @@ -13758,7 +14038,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@koa/cors@4.0.0': dependencies: @@ -13890,7 +14170,7 @@ snapshots: react-dom: 18.2.0(react@18.2.0) react-native: 0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10) - '@metamask/sdk@0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(utf-8-validate@5.0.10)': + '@metamask/sdk@0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(utf-8-validate@5.0.10)': dependencies: '@metamask/onboarding': 1.0.1 '@metamask/providers': 16.1.0 @@ -13911,7 +14191,7 @@ snapshots: qrcode-terminal-nooctal: 0.12.1 react-native-webview: 11.26.1(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0) readable-stream: 3.6.2 - rollup-plugin-visualizer: 5.12.0(rollup@3.29.4) + rollup-plugin-visualizer: 5.12.0(rollup@4.24.0) socket.io-client: 4.7.5(bufferutil@4.0.8)(utf-8-validate@5.0.10) util: 0.12.5 uuid: 8.3.2 @@ -13942,8 +14222,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -13956,8 +14236,8 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@metamask/superstruct': 3.1.0 - '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 '@types/debug': 4.1.7 debug: 4.3.7 pony-cause: 2.1.11 @@ -14970,7 +15250,7 @@ snapshots: '@types/react': 18.2.22 '@types/react-dom': 18.2.7 - '@rainbow-me/rainbowkit@2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))': + '@rainbow-me/rainbowkit@2.1.6(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8))': dependencies: '@tanstack/react-query': 5.52.0(react@18.2.0) '@vanilla-extract/css': 1.15.5 @@ -14983,7 +15263,7 @@ snapshots: react-remove-scroll: 2.6.0(@types/react@18.2.22)(react@18.2.0) ua-parser-js: 1.0.38 viem: 2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) - wagmi: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + wagmi: 2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) transitivePeerDependencies: - '@types/react' - babel-plugin-macros @@ -15292,6 +15572,54 @@ snapshots: '@remix-run/router@1.6.0': {} + '@rollup/rollup-android-arm-eabi@4.24.0': + optional: true + + '@rollup/rollup-android-arm64@4.24.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.24.0': + optional: true + + '@rollup/rollup-darwin-x64@4.24.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.24.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.24.0': + optional: true + + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.24.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.24.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.24.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.24.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.24.0': + optional: true + '@rushstack/eslint-patch@1.10.4': {} '@safe-global/safe-apps-provider@0.18.3(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)': @@ -15316,26 +15644,26 @@ snapshots: '@safe-global/safe-gateway-typescript-sdk@3.22.2': {} - '@scure/base@1.1.6': {} - '@scure/base@1.1.8': {} '@scure/bip32@1.4.0': dependencies: '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.3.0': dependencies: '@noble/hashes': 1.4.0 - '@scure/base': 1.1.6 + '@scure/base': 1.1.8 '@scure/bip39@1.4.0': dependencies: '@noble/hashes': 1.5.0 '@scure/base': 1.1.8 + '@sec-ant/readable-stream@0.4.1': {} + '@sentry-internal/tracing@7.86.0': dependencies: '@sentry/core': 7.86.0 @@ -15395,6 +15723,8 @@ snapshots: '@sinclair/typebox@0.27.8': {} + '@sindresorhus/merge-streams@4.0.0': {} + '@sinonjs/commons@2.0.0': dependencies: type-detect: 4.0.8 @@ -15913,6 +16243,8 @@ snapshots: '@types/emscripten@1.39.6': {} + '@types/estree@1.0.6': {} + '@types/express-serve-static-core@4.17.41': dependencies: '@types/node': 18.19.50 @@ -15993,8 +16325,6 @@ snapshots: '@types/mime@3.0.4': {} - '@types/mocha@9.1.1': {} - '@types/ms@0.7.31': {} '@types/node-forge@1.3.11': @@ -16274,32 +16604,72 @@ snapshots: '@vitest/utils': 0.34.6 chai: 4.5.0 + '@vitest/expect@2.1.2': + dependencies: + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 + chai: 5.1.1 + tinyrainbow: 1.2.0 + + '@vitest/mocker@2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@18.15.11)(terser@5.33.0))': + dependencies: + '@vitest/spy': 2.1.2 + estree-walker: 3.0.3 + magic-string: 0.30.11 + optionalDependencies: + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + + '@vitest/pretty-format@2.1.2': + dependencies: + tinyrainbow: 1.2.0 + '@vitest/runner@0.34.6': dependencies: '@vitest/utils': 0.34.6 p-limit: 4.0.0 pathe: 1.1.2 + '@vitest/runner@2.1.2': + dependencies: + '@vitest/utils': 2.1.2 + pathe: 1.1.2 + '@vitest/snapshot@0.34.6': dependencies: magic-string: 0.30.11 pathe: 1.1.2 pretty-format: 29.7.0 + '@vitest/snapshot@2.1.2': + dependencies: + '@vitest/pretty-format': 2.1.2 + magic-string: 0.30.11 + pathe: 1.1.2 + '@vitest/spy@0.34.6': dependencies: tinyspy: 2.2.1 + '@vitest/spy@2.1.2': + dependencies: + tinyspy: 3.0.2 + '@vitest/utils@0.34.6': dependencies: diff-sequences: 29.6.3 loupe: 2.3.7 pretty-format: 29.7.0 - '@wagmi/connectors@5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': + '@vitest/utils@2.1.2': + dependencies: + '@vitest/pretty-format': 2.1.2 + loupe: 3.1.1 + tinyrainbow: 1.2.0 + + '@wagmi/connectors@5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8)': dependencies: '@coinbase/wallet-sdk': 4.0.4 - '@metamask/sdk': 0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(utf-8-validate@5.0.10) + '@metamask/sdk': 0.28.2(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(utf-8-validate@5.0.10) '@safe-global/safe-apps-provider': 0.18.3(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8) '@wagmi/core': 2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)) @@ -16953,6 +17323,8 @@ snapshots: assertion-error@1.1.0: {} + assertion-error@2.0.1: {} + ast-parents@0.0.1: {} ast-types-flow@0.0.8: {} @@ -17312,6 +17684,14 @@ snapshots: pathval: 1.1.1 type-detect: 4.1.0 + chai@5.1.1: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.1 + pathval: 2.0.0 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -17337,6 +17717,8 @@ snapshots: dependencies: get-func-name: 2.0.2 + check-error@2.1.1: {} + chokidar@3.5.3: dependencies: anymatch: 3.1.3 @@ -17762,6 +18144,8 @@ snapshots: dependencies: type-detect: 4.1.0 + deep-eql@5.0.2: {} + deep-equal@1.0.1: {} deep-equal@2.2.3: @@ -18569,6 +18953,10 @@ snapshots: estraverse@5.3.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.6 + esutils@2.0.3: {} etag@1.8.1: {} @@ -18670,6 +19058,21 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 + execa@9.4.0: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.3 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 8.0.0 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 6.0.0 + pretty-ms: 9.1.0 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.1.1 + execcli@5.0.6: dependencies: argx: 4.0.4 @@ -18805,6 +19208,10 @@ snapshots: dependencies: escape-string-regexp: 1.0.5 + figures@6.1.0: + dependencies: + is-unicode-supported: 2.1.0 + file-entry-cache@5.0.1: dependencies: flat-cache: 2.0.1 @@ -19026,6 +19433,11 @@ snapshots: get-stream@8.0.1: {} + get-stream@9.0.1: + dependencies: + '@sec-ant/readable-stream': 0.4.1 + is-stream: 4.0.1 + get-symbol-description@1.0.0: dependencies: call-bind: 1.0.2 @@ -19295,6 +19707,8 @@ snapshots: human-signals@5.0.0: {} + human-signals@8.0.0: {} + humanize-ms@1.2.1: dependencies: ms: 2.1.3 @@ -19558,6 +19972,8 @@ snapshots: is-stream@3.0.0: {} + is-stream@4.0.1: {} + is-string@1.0.7: dependencies: has-tostringtag: 1.0.0 @@ -19576,6 +19992,8 @@ snapshots: is-unicode-supported@0.1.0: {} + is-unicode-supported@2.1.0: {} + is-utf8@0.2.1: {} is-weakmap@2.0.2: {} @@ -20502,6 +20920,10 @@ snapshots: dependencies: get-func-name: 2.0.2 + loupe@3.1.1: + dependencies: + get-func-name: 2.0.2 + lru-cache@10.3.0: {} lru-cache@10.4.3: {} @@ -20936,6 +21358,8 @@ snapshots: nanoid@3.3.6: {} + nanoid@3.3.7: {} + napi-build-utils@1.0.2: {} natural-compare@1.4.0: {} @@ -21059,6 +21483,11 @@ snapshots: dependencies: path-key: 4.0.0 + npm-run-path@6.0.0: + dependencies: + path-key: 4.0.0 + unicorn-magic: 0.3.0 + npmlog@6.0.2: dependencies: are-we-there-yet: 3.0.1 @@ -21381,6 +21810,8 @@ snapshots: pathval@1.1.1: {} + pathval@2.0.0: {} + peek-stream@1.1.3: dependencies: buffer-from: 1.1.2 @@ -21391,6 +21822,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.0: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -21494,12 +21927,12 @@ snapshots: optionalDependencies: postcss: 8.4.23 - postcss-load-config@3.1.4(postcss@8.4.31): + postcss-load-config@3.1.4(postcss@8.4.47): dependencies: lilconfig: 2.1.0 yaml: 1.10.2 optionalDependencies: - postcss: 8.4.31 + postcss: 8.4.47 postcss-load-config@4.0.1(postcss@8.4.23): dependencies: @@ -21532,6 +21965,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.0.2 + postcss@8.4.47: + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.0 + source-map-js: 1.2.1 + postgres@3.3.5: {} preact@10.23.2: {} @@ -22105,14 +22544,14 @@ snapshots: dependencies: glob: 7.2.3 - rollup-plugin-visualizer@5.12.0(rollup@3.29.4): + rollup-plugin-visualizer@5.12.0(rollup@4.24.0): dependencies: open: 8.4.2 picomatch: 2.3.1 source-map: 0.7.4 yargs: 17.7.2 optionalDependencies: - rollup: 3.29.4 + rollup: 4.24.0 rollup@3.21.8: optionalDependencies: @@ -22122,6 +22561,28 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + rollup@4.24.0: + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.24.0 + '@rollup/rollup-android-arm64': 4.24.0 + '@rollup/rollup-darwin-arm64': 4.24.0 + '@rollup/rollup-darwin-x64': 4.24.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.0 + '@rollup/rollup-linux-arm-musleabihf': 4.24.0 + '@rollup/rollup-linux-arm64-gnu': 4.24.0 + '@rollup/rollup-linux-arm64-musl': 4.24.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.0 + '@rollup/rollup-linux-riscv64-gnu': 4.24.0 + '@rollup/rollup-linux-s390x-gnu': 4.24.0 + '@rollup/rollup-linux-x64-gnu': 4.24.0 + '@rollup/rollup-linux-x64-musl': 4.24.0 + '@rollup/rollup-win32-arm64-msvc': 4.24.0 + '@rollup/rollup-win32-ia32-msvc': 4.24.0 + '@rollup/rollup-win32-x64-msvc': 4.24.0 + fsevents: 2.3.3 + rrweb-cssom@0.6.0: {} run-async@2.4.1: {} @@ -22440,6 +22901,8 @@ snapshots: source-map-js@1.0.2: {} + source-map-js@1.2.1: {} + source-map-support@0.5.13: dependencies: buffer-from: 1.1.2 @@ -22654,6 +23117,8 @@ snapshots: strip-final-newline@3.0.0: {} + strip-final-newline@4.0.0: {} + strip-json-comments@2.0.1: {} strip-json-comments@3.1.1: {} @@ -22878,10 +23343,18 @@ snapshots: tinybench@2.9.0: {} + tinyexec@0.3.0: {} + tinypool@0.7.0: {} + tinypool@1.0.1: {} + + tinyrainbow@1.2.0: {} + tinyspy@2.2.1: {} + tinyspy@3.0.2: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -23004,7 +23477,7 @@ snapshots: - supports-color - ts-node - tsup@6.7.0(postcss@8.4.31)(typescript@5.4.2): + tsup@6.7.0(postcss@8.4.47)(typescript@5.4.2): dependencies: bundle-require: 4.0.1(esbuild@0.17.17) cac: 6.7.14 @@ -23014,14 +23487,14 @@ snapshots: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 3.1.4(postcss@8.4.31) + postcss-load-config: 3.1.4(postcss@8.4.47) resolve-from: 5.0.0 rollup: 3.21.8 source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 optionalDependencies: - postcss: 8.4.31 + postcss: 8.4.47 typescript: 5.4.2 transitivePeerDependencies: - supports-color @@ -23177,6 +23650,8 @@ snapshots: unicode-property-aliases-ecmascript@2.1.0: {} + unicorn-magic@0.3.0: {} + unique-filename@2.0.1: dependencies: unique-slug: 3.0.0 @@ -23337,6 +23812,23 @@ snapshots: - supports-color - terser + vite-node@2.1.2(@types/node@18.15.11)(terser@5.33.0): + dependencies: + cac: 6.7.14 + debug: 4.3.7 + pathe: 1.1.2 + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite@4.5.5(@types/node@18.19.50)(terser@5.33.0): dependencies: esbuild: 0.18.20 @@ -23357,6 +23849,19 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 +<<<<<<< HEAD +======= + vite@5.4.8(@types/node@18.15.11)(terser@5.33.0): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.47 + rollup: 4.24.0 + optionalDependencies: + '@types/node': 18.15.11 + fsevents: 2.3.3 + terser: 5.33.0 + +>>>>>>> 908c0e600 (move store ts test to monorepo root) vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 @@ -23394,16 +23899,51 @@ snapshots: - supports-color - terser + vitest@2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): + dependencies: + '@vitest/expect': 2.1.2 + '@vitest/mocker': 2.1.2(@vitest/spy@2.1.2)(vite@5.4.8(@types/node@18.15.11)(terser@5.33.0)) + '@vitest/pretty-format': 2.1.2 + '@vitest/runner': 2.1.2 + '@vitest/snapshot': 2.1.2 + '@vitest/spy': 2.1.2 + '@vitest/utils': 2.1.2 + chai: 5.1.1 + debug: 4.3.7 + magic-string: 0.30.11 + pathe: 1.1.2 + std-env: 3.7.0 + tinybench: 2.9.0 + tinyexec: 0.3.0 + tinypool: 1.0.1 + tinyrainbow: 1.2.0 + vite: 5.4.8(@types/node@18.15.11)(terser@5.33.0) + vite-node: 2.1.2(@types/node@18.15.11)(terser@5.33.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 18.15.11 + jsdom: 22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vlq@1.0.1: {} w3c-xmlserializer@4.0.0: dependencies: xml-name-validator: 4.0.0 - wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): + wagmi@2.12.11(@tanstack/query-core@5.52.0)(@tanstack/react-query@5.52.0(react@18.2.0))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8): dependencies: '@tanstack/react-query': 5.52.0(react@18.2.0) - '@wagmi/connectors': 5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@3.29.4)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) + '@wagmi/connectors': 5.1.10(@types/react@18.2.22)(@wagmi/core@2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)))(bufferutil@4.0.8)(encoding@0.1.13)(react-dom@18.2.0(react@18.2.0))(react-native@0.75.2(@babel/core@7.25.2)(@babel/preset-env@7.25.3(@babel/core@7.25.2))(@types/react@18.2.22)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.2.0)(typescript@5.4.2)(utf-8-validate@5.0.10))(react@18.2.0)(rollup@4.24.0)(typescript@5.4.2)(utf-8-validate@5.0.10)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8))(zod@3.23.8) '@wagmi/core': 2.13.5(@tanstack/query-core@5.52.0)(@types/react@18.2.22)(react@18.2.0)(typescript@5.4.2)(viem@2.21.6(bufferutil@4.0.8)(typescript@5.4.2)(utf-8-validate@5.0.10)(zod@3.23.8)) react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) @@ -23448,7 +23988,7 @@ snapshots: webauthn-p256@0.0.5: dependencies: '@noble/curves': 1.4.2 - '@noble/hashes': 1.4.0 + '@noble/hashes': 1.5.0 webextension-polyfill@0.10.0: {} @@ -23722,6 +24262,8 @@ snapshots: yocto-queue@1.0.0: {} + yoctocolors@2.1.1: {} + zod-validation-error@1.3.0(zod@3.23.8): dependencies: zod: 3.23.8 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 07248c79f9..6f2a1dc3f7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,6 +1,7 @@ packages: - packages/* - - test/* + - test/mock-game-contracts + - test/ts-benchmarks catalog: "@ark/attest": "0.12.1" diff --git a/test-setup/anvil.ts b/test-setup/anvil.ts new file mode 100644 index 0000000000..35d83f4304 --- /dev/null +++ b/test-setup/anvil.ts @@ -0,0 +1,18 @@ +import { beforeAll, beforeEach } from "vitest"; +import { testClient } from "./common"; + +// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. +beforeAll(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); + +// Some tests execute transactions, so we restore chain state here. +beforeEach(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); diff --git a/test-setup/common.ts b/test-setup/common.ts new file mode 100644 index 0000000000..5f24cf4266 --- /dev/null +++ b/test-setup/common.ts @@ -0,0 +1,23 @@ +import { createTestClient, http } from "viem"; + +export const anvilHost = "127.0.0.1"; +export const anvilPort = 8556; + +// ID of the current test worker. Used by the `@viem/anvil` proxy server. +export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); + +export const anvilRpcUrl = `http://${anvilHost}:${anvilPort}/${poolId}`; + +export const testClient = createTestClient({ + mode: "anvil", + // TODO: if tests get slow, try switching to websockets? + transport: http(anvilRpcUrl), + pollingInterval: 10, +}); + +export async function snapshotAnvilState() { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +} diff --git a/test-setup/global/anvil.ts b/test-setup/global/anvil.ts new file mode 100644 index 0000000000..f424fc5b0a --- /dev/null +++ b/test-setup/global/anvil.ts @@ -0,0 +1,19 @@ +import { startProxy as startAnvilProxy } from "@viem/anvil"; +import { anvilHost, anvilPort } from "../common"; +import { execa } from "execa"; + +export default async function globalSetup(): Promise<() => Promise> { + console.log("building mock game"); + await execa("pnpm", ["run", "build"], { + cwd: `${__dirname}/../../test/mock-game-contracts`, + }); + + const shutdownAnvilProxy = await startAnvilProxy({ + host: anvilHost, + port: anvilPort, + }); + + return async () => { + await shutdownAnvilProxy(); + }; +} diff --git a/packages/store/vitestSetup.ts b/test-setup/global/arktype.ts similarity index 100% rename from packages/store/vitestSetup.ts rename to test-setup/global/arktype.ts diff --git a/test-setup/mockGame.ts b/test-setup/mockGame.ts new file mode 100644 index 0000000000..e76172a1a5 --- /dev/null +++ b/test-setup/mockGame.ts @@ -0,0 +1,35 @@ +import { execa } from "execa"; +import { anvilRpcUrl } from "./common"; +import { Hex, isHex } from "viem"; +import config from "../test/mock-game-contracts/mud.config"; +import worldAbi from "../test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; + +export { config, worldAbi }; + +export async function deployMockGame(): Promise { + console.log("deploying mock game to", anvilRpcUrl); + const { stdout, stderr } = await execa( + "pnpm", + // skip build because its slow and we do it in global setup + // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... + ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], + { + cwd: `${__dirname}/../test/mock-game-contracts`, + env: { + // anvil default account + PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + DEBUG: "mud:*", + }, + }, + ); + if (stderr) console.error(stderr); + if (stdout) console.log(stdout); + + const [, worldAddress] = stdout.match(/worldAddress: '(0x[0-9a-f]+)'/i) ?? []; + if (!isHex(worldAddress)) { + throw new Error("world address not found in output, did the deploy fail?"); + } + console.log("deployed mock game", worldAddress); + + return worldAddress; +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000000..f0ed65772f --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globalSetup: [`${__dirname}/test-setup/global/arktype.ts`, `${__dirname}/test-setup/global/anvil.ts`], + setupFiles: [`${__dirname}/test-setup/anvil.ts`], + // Temporarily set a low teardown timeout because anvil hangs otherwise + // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 + teardownTimeout: 500, + hookTimeout: 15000, + }, + server: { + watch: { + // we build+import this file in test setup, which causes vitest to restart in a loop unless we ignore it here + ignored: ["**/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"], + }, + }, +}); From 7a55058c2d26bb90bb7e99ddf6ef564130ad43fc Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:06:03 +0100 Subject: [PATCH 22/32] don't need this --- test-setup/anvil.ts | 18 ------------------ vitest.config.ts | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 test-setup/anvil.ts diff --git a/test-setup/anvil.ts b/test-setup/anvil.ts deleted file mode 100644 index 35d83f4304..0000000000 --- a/test-setup/anvil.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { beforeAll, beforeEach } from "vitest"; -import { testClient } from "./common"; - -// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. -beforeAll(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); - -// Some tests execute transactions, so we restore chain state here. -beforeEach(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); diff --git a/vitest.config.ts b/vitest.config.ts index f0ed65772f..07598d9eb1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { globalSetup: [`${__dirname}/test-setup/global/arktype.ts`, `${__dirname}/test-setup/global/anvil.ts`], - setupFiles: [`${__dirname}/test-setup/anvil.ts`], + setupFiles: [], // Temporarily set a low teardown timeout because anvil hangs otherwise // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 teardownTimeout: 500, From fee996a8ddb0f83d81fe95e2eaff00eb5aa9ea53 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:07:56 +0100 Subject: [PATCH 23/32] fix lockfile --- pnpm-lock.yaml | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a1ed1cc35..dd7f3f9be3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,9 +6,21 @@ settings: catalogs: default: + '@ark/attest': + specifier: 0.12.1 + version: 0.12.1 + '@ark/util': + specifier: 0.2.2 + version: 0.2.2 '@wagmi/core': specifier: 2.13.5 version: 2.13.5 + abitype: + specifier: 1.0.6 + version: 1.0.6 + arktype: + specifier: 2.0.0-beta.6 + version: 2.0.0-beta.6 viem: specifier: 2.21.6 version: 2.21.6 @@ -815,10 +827,10 @@ importers: version: 8.3.4 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@20.12.12) + version: 29.5.0(@types/node@18.15.11) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -970,12 +982,6 @@ importers: tsx: specifier: ^3.12.6 version: 3.12.6 -<<<<<<< HEAD - vitest: - specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) -======= ->>>>>>> 908c0e600 (move store ts test to monorepo root) packages/store-indexer: dependencies: @@ -1206,10 +1212,10 @@ importers: version: 27.4.1 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@18.15.11) + version: 29.5.0(@types/node@20.12.12) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -9438,9 +9444,6 @@ packages: postgres@3.3.5: resolution: {integrity: sha512-+JD93VELV9gHkqpV5gdL5/70HdGtEw4/XE1S4BC8f1mcPmdib3K5XsKVbnR1XcAyC41zOnifJ+9YRKxdIsXiUw==} - preact@10.23.2: - resolution: {integrity: sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==} - preact@10.24.0: resolution: {integrity: sha512-aK8Cf+jkfyuZ0ZZRG9FbYqwmEiGQ4y/PUO4SuTWoyWL244nZZh7bd5h2APd4rSNDYTBNghg1L+5iJN3Skxtbsw==} @@ -13145,7 +13148,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.25.3 '@babel/types': 7.25.2 - debug: 4.3.4 + debug: 4.3.7 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -13375,7 +13378,7 @@ snapshots: clsx: 1.2.1 eventemitter3: 5.0.1 keccak: 3.0.4 - preact: 10.23.2 + preact: 10.24.0 sha.js: 2.4.11 '@emotion/hash@0.9.2': {} @@ -17368,7 +17371,7 @@ snapshots: avvio@8.2.1: dependencies: archy: 1.0.0 - debug: 4.3.4 + debug: 4.3.7 fastq: 1.15.0 transitivePeerDependencies: - supports-color @@ -18707,7 +18710,7 @@ snapshots: eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0): dependencies: - debug: 4.3.4 + debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.0 eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) @@ -19717,11 +19720,11 @@ snapshots: i18next-browser-languagedetector@7.1.0: dependencies: - '@babel/runtime': 7.25.0 + '@babel/runtime': 7.25.6 i18next@23.11.5: dependencies: - '@babel/runtime': 7.25.0 + '@babel/runtime': 7.25.6 iconv-lite@0.4.24: dependencies: @@ -21973,8 +21976,6 @@ snapshots: postgres@3.3.5: {} - preact@10.23.2: {} - preact@10.24.0: {} prebuild-install@7.1.1: @@ -23849,8 +23850,6 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 -<<<<<<< HEAD -======= vite@5.4.8(@types/node@18.15.11)(terser@5.33.0): dependencies: esbuild: 0.21.5 @@ -23861,7 +23860,6 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 ->>>>>>> 908c0e600 (move store ts test to monorepo root) vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 From 42eec212de19053d19fd9936ac3be09923811f55 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:29:01 +0100 Subject: [PATCH 24/32] rollback execa version for create-mud since its still dependent on cjs --- packages/create-mud/package.json | 1 + pnpm-lock.yaml | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/create-mud/package.json b/packages/create-mud/package.json index 183b25f228..d891afc02d 100644 --- a/packages/create-mud/package.json +++ b/packages/create-mud/package.json @@ -28,6 +28,7 @@ }, "devDependencies": { "@types/node": "^18.15.11", + "execa": "^7.0.0", "tsup": "^6.7.0" }, "publishConfig": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dd7f3f9be3..9490e6f56e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -386,6 +386,9 @@ importers: '@types/node': specifier: ^18.15.11 version: 18.15.11 + execa: + specifier: ^7.0.0 + version: 7.2.0 tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -827,10 +830,10 @@ importers: version: 8.3.4 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@18.15.11) + version: 29.5.0(@types/node@20.12.12) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -1212,10 +1215,10 @@ importers: version: 27.4.1 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@20.12.12) + version: 29.5.0(@types/node@18.15.11) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -19044,7 +19047,7 @@ snapshots: human-signals: 4.3.1 is-stream: 3.0.0 merge-stream: 2.0.0 - npm-run-path: 5.1.0 + npm-run-path: 5.3.0 onetime: 6.0.0 signal-exit: 3.0.7 strip-final-newline: 3.0.0 From 441a48eb237445775018ccdc8aba0634f5348aca Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:34:01 +0100 Subject: [PATCH 25/32] don't run CI tests in parallel for now --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a233f5069e..d8bd2a434f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", "test": "pnpm run --recursive test", - "test:ci": "pnpm run --recursive --parallel test:ci", + "test:ci": "pnpm run --recursive --sequential test:ci", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" From c597c3fd19e66ce1f0a4cc74de0d5fe861cb82d3 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 12:56:21 +0100 Subject: [PATCH 26/32] no anvil in default vitest config --- package.json | 2 +- packages/store/vitest.config.ts | 3 +++ vitest.config.ts | 27 ++++++++++++++++++++------- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 packages/store/vitest.config.ts diff --git a/package.json b/package.json index d8bd2a434f..019dd50df1 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", "test": "pnpm run --recursive test", - "test:ci": "pnpm run --recursive --sequential test:ci", + "test:ci": "pnpm run --recursive test:ci", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" diff --git a/packages/store/vitest.config.ts b/packages/store/vitest.config.ts new file mode 100644 index 0000000000..06a6891247 --- /dev/null +++ b/packages/store/vitest.config.ts @@ -0,0 +1,3 @@ +import anvilConfig from "../../vitest.config"; + +export default anvilConfig; diff --git a/vitest.config.ts b/vitest.config.ts index 07598d9eb1..61109b4bfe 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,13 +1,9 @@ -import { defineConfig } from "vitest/config"; +import { defineConfig, mergeConfig } from "vitest/config"; -export default defineConfig({ +export const baseConfig = defineConfig({ test: { - globalSetup: [`${__dirname}/test-setup/global/arktype.ts`, `${__dirname}/test-setup/global/anvil.ts`], + globalSetup: [`${__dirname}/test-setup/global/arktype.ts`], setupFiles: [], - // Temporarily set a low teardown timeout because anvil hangs otherwise - // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 - teardownTimeout: 500, - hookTimeout: 15000, }, server: { watch: { @@ -16,3 +12,20 @@ export default defineConfig({ }, }, }); + +// TODO: migrate to prool: https://github.com/wevm/prool +// note that using this across packages running tests in parallel may cause port issues +export const anvilConfig = mergeConfig( + baseConfig, + defineConfig({ + test: { + globalSetup: [`${__dirname}/test-setup/global/anvil.ts`], + // Temporarily set a low teardown timeout because anvil hangs otherwise + // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 + teardownTimeout: 500, + hookTimeout: 15000, + }, + }), +); + +export default baseConfig; From 5dcef24b72365c2fb7f4c580666e39e20fcd5e88 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 13:28:13 +0100 Subject: [PATCH 27/32] try starting anvil as a pretest step --- package.json | 5 +- packages/store/vitest.config.ts | 3 - pnpm-lock.yaml | 101 +++++++++++++++++++++++--------- test-setup/common.ts | 4 +- test-setup/global/anvil.ts | 19 ------ test-setup/startAnvil.ts | 24 ++++++++ vitest.config.ts | 25 ++------ 7 files changed, 109 insertions(+), 72 deletions(-) delete mode 100644 packages/store/vitest.config.ts delete mode 100644 test-setup/global/anvil.ts create mode 100644 test-setup/startAnvil.ts diff --git a/package.json b/package.json index 019dd50df1..a6da13ae96 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", + "pretest": "ANVIL_PORT=8556 tsx test-setup/startAnvil.ts & wait-on tcp:8556", "test": "pnpm run --recursive test", + "pretest:ci": "pnpm run pretest", "test:ci": "pnpm run --recursive test:ci", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", @@ -57,7 +59,8 @@ "turbo": "^1.9.3", "typescript": "5.4.2", "viem": "catalog:", - "vitest": "2.1.2" + "vitest": "2.1.2", + "wait-on": "^8.0.1" }, "packageManager": "pnpm@9.6.0", "engines": { diff --git a/packages/store/vitest.config.ts b/packages/store/vitest.config.ts deleted file mode 100644 index 06a6891247..0000000000 --- a/packages/store/vitest.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import anvilConfig from "../../vitest.config"; - -export default anvilConfig; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9490e6f56e..524bb7f5d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -95,6 +95,9 @@ importers: vitest: specifier: 2.1.2 version: 2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) + wait-on: + specifier: ^8.0.1 + version: 8.0.1 packages/abi-ts: dependencies: @@ -5776,6 +5779,9 @@ packages: resolution: {integrity: sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==} engines: {node: '>=4'} + axios@1.7.7: + resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} + axobject-query@3.1.1: resolution: {integrity: sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==} @@ -7269,6 +7275,15 @@ packages: debug: optional: true + follow-redirects@1.15.9: + resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -9621,6 +9636,9 @@ packages: proxy-deep@3.1.1: resolution: {integrity: sha512-kppbvLUNJ4IOMZds9/4gz/rtT5OFiesy3XosLsgMKlF3vb6GA5Y3ptyDlzKLcOcUBW+zaY+RiMINTsgE+O6e+Q==} + proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + pseudomap@1.0.2: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} @@ -11294,6 +11312,11 @@ packages: typescript: optional: true + wait-on@8.0.1: + resolution: {integrity: sha512-1wWQOyR2LVVtaqrcIL2+OM+x7bkpmzVROa0Nf6FryXkS+er5Sa1kzFGjzZRqLnHa3n1rACFLeTwUqE1ETL9Mig==} + engines: {node: '>=12.0.0'} + hasBin: true + walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -11779,7 +11802,7 @@ snapshots: '@smithy/util-middleware': 2.2.0 '@smithy/util-retry': 2.2.0 '@smithy/util-utf8': 2.3.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - aws-crt @@ -11822,7 +11845,7 @@ snapshots: '@smithy/util-middleware': 2.2.0 '@smithy/util-retry': 2.2.0 '@smithy/util-utf8': 2.3.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - aws-crt @@ -11885,7 +11908,7 @@ snapshots: '@aws-sdk/types': 3.535.0 '@smithy/property-provider': 2.2.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@aws-sdk/credential-provider-http@3.552.0': dependencies: @@ -11897,7 +11920,7 @@ snapshots: '@smithy/smithy-client': 2.5.1 '@smithy/types': 2.12.0 '@smithy/util-stream': 2.2.0 - tslib: 2.6.2 + tslib: 2.7.0 '@aws-sdk/credential-provider-ini@3.556.0(@aws-sdk/credential-provider-node@3.556.0)': dependencies: @@ -11911,7 +11934,7 @@ snapshots: '@smithy/property-provider': 2.2.0 '@smithy/shared-ini-file-loader': 2.4.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt @@ -11939,7 +11962,7 @@ snapshots: '@smithy/property-provider': 2.2.0 '@smithy/shared-ini-file-loader': 2.4.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@aws-sdk/credential-provider-sso@3.556.0(@aws-sdk/credential-provider-node@3.556.0)': dependencies: @@ -11949,7 +11972,7 @@ snapshots: '@smithy/property-provider': 2.2.0 '@smithy/shared-ini-file-loader': 2.4.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt @@ -11960,7 +11983,7 @@ snapshots: '@aws-sdk/types': 3.535.0 '@smithy/property-provider': 2.2.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt @@ -12009,7 +12032,7 @@ snapshots: '@smithy/property-provider': 2.2.0 '@smithy/shared-ini-file-loader': 2.4.0 '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 transitivePeerDependencies: - '@aws-sdk/credential-provider-node' - aws-crt @@ -12028,7 +12051,7 @@ snapshots: '@aws-sdk/util-locate-window@3.535.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@aws-sdk/util-user-agent-browser@3.535.0': dependencies: @@ -12046,7 +12069,7 @@ snapshots: '@aws-sdk/util-utf8-browser@3.259.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@babel/code-frame@7.21.4': dependencies: @@ -15750,7 +15773,7 @@ snapshots: '@smithy/abort-controller@2.2.0': dependencies: '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/config-resolver@2.2.0': dependencies: @@ -15777,7 +15800,7 @@ snapshots: '@smithy/property-provider': 2.2.0 '@smithy/types': 2.12.0 '@smithy/url-parser': 2.2.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/fetch-http-handler@2.5.0': dependencies: @@ -15801,7 +15824,7 @@ snapshots: '@smithy/is-array-buffer@2.2.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/middleware-content-length@2.2.0': dependencies: @@ -15859,7 +15882,7 @@ snapshots: '@smithy/property-provider@2.2.0': dependencies: '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/protocol-http@3.3.0': dependencies: @@ -15870,12 +15893,12 @@ snapshots: dependencies: '@smithy/types': 2.12.0 '@smithy/util-uri-escape': 2.2.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/querystring-parser@2.2.0': dependencies: '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/service-error-classification@2.1.5': dependencies: @@ -15884,7 +15907,7 @@ snapshots: '@smithy/shared-ini-file-loader@2.4.0': dependencies: '@smithy/types': 2.12.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/signature-v4@2.3.0': dependencies: @@ -15936,7 +15959,7 @@ snapshots: '@smithy/util-config-provider@2.3.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/util-defaults-mode-browser@2.2.1': dependencies: @@ -15964,7 +15987,7 @@ snapshots: '@smithy/util-hex-encoding@2.2.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/util-middleware@2.2.0': dependencies: @@ -15986,11 +16009,11 @@ snapshots: '@smithy/util-buffer-from': 2.2.0 '@smithy/util-hex-encoding': 2.2.0 '@smithy/util-utf8': 2.3.0 - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/util-uri-escape@2.2.0': dependencies: - tslib: 2.6.2 + tslib: 2.7.0 '@smithy/util-utf8@2.3.0': dependencies: @@ -17381,6 +17404,14 @@ snapshots: axe-core@4.10.0: {} + axios@1.7.7: + dependencies: + follow-redirects: 1.15.9 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + axobject-query@3.1.1: dependencies: deep-equal: 2.2.3 @@ -19317,6 +19348,8 @@ snapshots: optionalDependencies: debug: 4.3.4 + follow-redirects@1.15.9: {} + for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -22104,6 +22137,8 @@ snapshots: proxy-deep@3.1.1: {} + proxy-from-env@1.1.0: {} + pseudomap@1.0.2: {} psl@1.9.0: {} @@ -22282,7 +22317,7 @@ snapshots: dependencies: react: 18.2.0 react-style-singleton: 2.2.1(@types/react@18.2.22)(react@18.2.0) - tslib: 2.6.2 + tslib: 2.7.0 optionalDependencies: '@types/react': 18.2.22 @@ -22291,7 +22326,7 @@ snapshots: react: 18.2.0 react-remove-scroll-bar: 2.3.6(@types/react@18.2.22)(react@18.2.0) react-style-singleton: 2.2.1(@types/react@18.2.22)(react@18.2.0) - tslib: 2.6.2 + tslib: 2.7.0 use-callback-ref: 1.3.2(@types/react@18.2.22)(react@18.2.0) use-sidecar: 1.1.2(@types/react@18.2.22)(react@18.2.0) optionalDependencies: @@ -22342,7 +22377,7 @@ snapshots: get-nonce: 1.0.1 invariant: 2.2.4 react: 18.2.0 - tslib: 2.6.2 + tslib: 2.7.0 optionalDependencies: '@types/react': 18.2.22 @@ -22605,7 +22640,7 @@ snapshots: rxjs@7.8.1: dependencies: - tslib: 2.6.2 + tslib: 2.7.0 safe-array-concat@1.1.2: dependencies: @@ -23719,7 +23754,7 @@ snapshots: use-callback-ref@1.3.2(@types/react@18.2.22)(react@18.2.0): dependencies: react: 18.2.0 - tslib: 2.6.2 + tslib: 2.7.0 optionalDependencies: '@types/react': 18.2.22 @@ -23732,7 +23767,7 @@ snapshots: dependencies: detect-node-es: 1.1.0 react: 18.2.0 - tslib: 2.6.2 + tslib: 2.7.0 optionalDependencies: '@types/react': 18.2.22 @@ -23978,6 +24013,16 @@ snapshots: - utf-8-validate - zod + wait-on@8.0.1: + dependencies: + axios: 1.7.7 + joi: 17.13.3 + lodash: 4.17.21 + minimist: 1.2.8 + rxjs: 7.8.1 + transitivePeerDependencies: + - debug + walker@1.0.8: dependencies: makeerror: 1.0.12 diff --git a/test-setup/common.ts b/test-setup/common.ts index 5f24cf4266..d4d37cf6bc 100644 --- a/test-setup/common.ts +++ b/test-setup/common.ts @@ -1,7 +1,7 @@ import { createTestClient, http } from "viem"; -export const anvilHost = "127.0.0.1"; -export const anvilPort = 8556; +export const anvilHost = process.env.ANVIL_HOST ?? "127.0.0.1"; +export const anvilPort = process.env.ANVIL_PORT ?? "8556"; // ID of the current test worker. Used by the `@viem/anvil` proxy server. export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); diff --git a/test-setup/global/anvil.ts b/test-setup/global/anvil.ts deleted file mode 100644 index f424fc5b0a..0000000000 --- a/test-setup/global/anvil.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { startProxy as startAnvilProxy } from "@viem/anvil"; -import { anvilHost, anvilPort } from "../common"; -import { execa } from "execa"; - -export default async function globalSetup(): Promise<() => Promise> { - console.log("building mock game"); - await execa("pnpm", ["run", "build"], { - cwd: `${__dirname}/../../test/mock-game-contracts`, - }); - - const shutdownAnvilProxy = await startAnvilProxy({ - host: anvilHost, - port: anvilPort, - }); - - return async () => { - await shutdownAnvilProxy(); - }; -} diff --git a/test-setup/startAnvil.ts b/test-setup/startAnvil.ts new file mode 100644 index 0000000000..dcce6d2d33 --- /dev/null +++ b/test-setup/startAnvil.ts @@ -0,0 +1,24 @@ +import { startProxy as startAnvilProxy } from "@viem/anvil"; +import { anvilHost, anvilPort } from "./common"; +import { execa } from "execa"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +console.log("building mock game"); +await execa("pnpm", ["run", "build"], { + cwd: `${__dirname}/../test/mock-game-contracts`, +}); + +console.log("starting anvil proxy"); +await startAnvilProxy({ + host: anvilHost, + port: Number(anvilPort), +}); + +// ensure anvil dies +process.on("SIGINT", () => process.exit()); +process.on("SIGTERM", () => process.exit()); +process.on("SIGQUIT", () => process.exit()); diff --git a/vitest.config.ts b/vitest.config.ts index 61109b4bfe..5969e8ee90 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,9 +1,13 @@ -import { defineConfig, mergeConfig } from "vitest/config"; +import { defineConfig } from "vitest/config"; -export const baseConfig = defineConfig({ +export default defineConfig({ test: { globalSetup: [`${__dirname}/test-setup/global/arktype.ts`], setupFiles: [], + // Temporarily set a low teardown timeout because anvil hangs otherwise + // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 + teardownTimeout: 500, + hookTimeout: 15000, }, server: { watch: { @@ -12,20 +16,3 @@ export const baseConfig = defineConfig({ }, }, }); - -// TODO: migrate to prool: https://github.com/wevm/prool -// note that using this across packages running tests in parallel may cause port issues -export const anvilConfig = mergeConfig( - baseConfig, - defineConfig({ - test: { - globalSetup: [`${__dirname}/test-setup/global/anvil.ts`], - // Temporarily set a low teardown timeout because anvil hangs otherwise - // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 - teardownTimeout: 500, - hookTimeout: 15000, - }, - }), -); - -export default baseConfig; From 4bc6c0d883952b8fae1426933126b9747cb98bee Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 13:37:05 +0100 Subject: [PATCH 28/32] try this --- package.json | 7 +++---- test-setup/common.ts | 4 ++-- test-setup/startAnvil.ts | 5 +---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index a6da13ae96..91bd09220e 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,9 @@ "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", - "pretest": "ANVIL_PORT=8556 tsx test-setup/startAnvil.ts & wait-on tcp:8556", - "test": "pnpm run --recursive test", - "pretest:ci": "pnpm run pretest", - "test:ci": "pnpm run --recursive test:ci", + "test": "pnpm run test:start-anvil & wait-on tcp:8556 && pnpm run --recursive test", + "test:ci": "pnpm run test:start-anvil & wait-on tcp:8556 && pnpm run --recursive test:ci", + "test:start-anvil": "tsx test-setup/startAnvil.ts", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" diff --git a/test-setup/common.ts b/test-setup/common.ts index d4d37cf6bc..5ca803fdfe 100644 --- a/test-setup/common.ts +++ b/test-setup/common.ts @@ -1,7 +1,7 @@ import { createTestClient, http } from "viem"; -export const anvilHost = process.env.ANVIL_HOST ?? "127.0.0.1"; -export const anvilPort = process.env.ANVIL_PORT ?? "8556"; +export const anvilHost = process.env.ANVIL_HOST || "127.0.0.1"; +export const anvilPort = Number(process.env.ANVIL_PORT) || 8556; // ID of the current test worker. Used by the `@viem/anvil` proxy server. export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); diff --git a/test-setup/startAnvil.ts b/test-setup/startAnvil.ts index dcce6d2d33..c890b99cc5 100644 --- a/test-setup/startAnvil.ts +++ b/test-setup/startAnvil.ts @@ -13,10 +13,7 @@ await execa("pnpm", ["run", "build"], { }); console.log("starting anvil proxy"); -await startAnvilProxy({ - host: anvilHost, - port: Number(anvilPort), -}); +await startAnvilProxy({ host: anvilHost, port: anvilPort }); // ensure anvil dies process.on("SIGINT", () => process.exit()); From 42cf12b1bbcdb9e0f5c749a8559d84c86f0f146f Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 13:41:56 +0100 Subject: [PATCH 29/32] no wait on --- package.json | 8 +++--- pnpm-lock.yaml | 53 +++------------------------------------- test-setup/startAnvil.ts | 11 --------- 3 files changed, 7 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index 91bd09220e..ca8de8282a 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,8 @@ "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", - "test": "pnpm run test:start-anvil & wait-on tcp:8556 && pnpm run --recursive test", - "test:ci": "pnpm run test:start-anvil & wait-on tcp:8556 && pnpm run --recursive test:ci", - "test:start-anvil": "tsx test-setup/startAnvil.ts", + "test": "tsx test-setup/startAnvil.ts & pnpm run --recursive test", + "test:ci": "tsx test-setup/startAnvil.ts & pnpm run --recursive test:ci", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" @@ -58,8 +57,7 @@ "turbo": "^1.9.3", "typescript": "5.4.2", "viem": "catalog:", - "vitest": "2.1.2", - "wait-on": "^8.0.1" + "vitest": "2.1.2" }, "packageManager": "pnpm@9.6.0", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 524bb7f5d8..17395df624 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -95,9 +95,6 @@ importers: vitest: specifier: 2.1.2 version: 2.1.2(@types/node@18.15.11)(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) - wait-on: - specifier: ^8.0.1 - version: 8.0.1 packages/abi-ts: dependencies: @@ -833,10 +830,10 @@ importers: version: 8.3.4 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@20.12.12) + version: 29.5.0(@types/node@18.15.11) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -1218,10 +1215,10 @@ importers: version: 27.4.1 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@18.15.11) + version: 29.5.0(@types/node@20.12.12) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) @@ -5779,9 +5776,6 @@ packages: resolution: {integrity: sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==} engines: {node: '>=4'} - axios@1.7.7: - resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} - axobject-query@3.1.1: resolution: {integrity: sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==} @@ -7275,15 +7269,6 @@ packages: debug: optional: true - follow-redirects@1.15.9: - resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -9636,9 +9621,6 @@ packages: proxy-deep@3.1.1: resolution: {integrity: sha512-kppbvLUNJ4IOMZds9/4gz/rtT5OFiesy3XosLsgMKlF3vb6GA5Y3ptyDlzKLcOcUBW+zaY+RiMINTsgE+O6e+Q==} - proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - pseudomap@1.0.2: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} @@ -11312,11 +11294,6 @@ packages: typescript: optional: true - wait-on@8.0.1: - resolution: {integrity: sha512-1wWQOyR2LVVtaqrcIL2+OM+x7bkpmzVROa0Nf6FryXkS+er5Sa1kzFGjzZRqLnHa3n1rACFLeTwUqE1ETL9Mig==} - engines: {node: '>=12.0.0'} - hasBin: true - walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -17404,14 +17381,6 @@ snapshots: axe-core@4.10.0: {} - axios@1.7.7: - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - axobject-query@3.1.1: dependencies: deep-equal: 2.2.3 @@ -19348,8 +19317,6 @@ snapshots: optionalDependencies: debug: 4.3.4 - follow-redirects@1.15.9: {} - for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -22137,8 +22104,6 @@ snapshots: proxy-deep@3.1.1: {} - proxy-from-env@1.1.0: {} - pseudomap@1.0.2: {} psl@1.9.0: {} @@ -24013,16 +23978,6 @@ snapshots: - utf-8-validate - zod - wait-on@8.0.1: - dependencies: - axios: 1.7.7 - joi: 17.13.3 - lodash: 4.17.21 - minimist: 1.2.8 - rxjs: 7.8.1 - transitivePeerDependencies: - - debug - walker@1.0.8: dependencies: makeerror: 1.0.12 diff --git a/test-setup/startAnvil.ts b/test-setup/startAnvil.ts index c890b99cc5..4d3894f0d5 100644 --- a/test-setup/startAnvil.ts +++ b/test-setup/startAnvil.ts @@ -1,16 +1,5 @@ import { startProxy as startAnvilProxy } from "@viem/anvil"; import { anvilHost, anvilPort } from "./common"; -import { execa } from "execa"; -import { fileURLToPath } from "node:url"; -import path from "node:path"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -console.log("building mock game"); -await execa("pnpm", ["run", "build"], { - cwd: `${__dirname}/../test/mock-game-contracts`, -}); console.log("starting anvil proxy"); await startAnvilProxy({ host: anvilHost, port: anvilPort }); From 5a3936657b4fd032535e747a192f6a5ecff12e99 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 13:52:09 +0100 Subject: [PATCH 30/32] remove unused files --- test-setup/anvil.ts | 18 ------------------ test-setup/global/anvil.ts | 19 ------------------- 2 files changed, 37 deletions(-) delete mode 100644 test-setup/anvil.ts delete mode 100644 test-setup/global/anvil.ts diff --git a/test-setup/anvil.ts b/test-setup/anvil.ts deleted file mode 100644 index 35d83f4304..0000000000 --- a/test-setup/anvil.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { beforeAll, beforeEach } from "vitest"; -import { testClient } from "./common"; - -// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. -beforeAll(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); - -// Some tests execute transactions, so we restore chain state here. -beforeEach(async () => { - const state = await testClient.dumpState(); - return async (): Promise => { - await testClient.loadState({ state }); - }; -}); diff --git a/test-setup/global/anvil.ts b/test-setup/global/anvil.ts deleted file mode 100644 index f424fc5b0a..0000000000 --- a/test-setup/global/anvil.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { startProxy as startAnvilProxy } from "@viem/anvil"; -import { anvilHost, anvilPort } from "../common"; -import { execa } from "execa"; - -export default async function globalSetup(): Promise<() => Promise> { - console.log("building mock game"); - await execa("pnpm", ["run", "build"], { - cwd: `${__dirname}/../../test/mock-game-contracts`, - }); - - const shutdownAnvilProxy = await startAnvilProxy({ - host: anvilHost, - port: anvilPort, - }); - - return async () => { - await shutdownAnvilProxy(); - }; -} From bb64a18254814a79c7d54c19336be609563f8c47 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 13:59:16 +0100 Subject: [PATCH 31/32] try building mock-game-contracts before --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c35909ace..d091200811 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", - "test": "tsx test-setup/startAnvil.ts & pnpm run --recursive test", - "test:ci": "tsx test-setup/startAnvil.ts & pnpm run --recursive test:ci", + "test": "tsx test-setup/startAnvil.ts & pnpm run --filter mock-game-contracts build && pnpm run --recursive test", + "test:ci": "tsx test-setup/startAnvil.ts & pnpm run --filter mock-game-contracts build && pnpm run --recursive test:ci", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" From b8fca8e376dae1b1916869fd140dc5f2ab07890a Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sun, 6 Oct 2024 14:09:42 +0100 Subject: [PATCH 32/32] clean up --- package.json | 5 +++-- packages/store/package.json | 3 +-- pnpm-lock.yaml | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d091200811..c8e7e1b53b 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,9 @@ "release:check": "changeset status --verbose --since=origin/main", "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", - "test": "tsx test-setup/startAnvil.ts & pnpm run --filter mock-game-contracts build && pnpm run --recursive test", - "test:ci": "tsx test-setup/startAnvil.ts & pnpm run --filter mock-game-contracts build && pnpm run --recursive test:ci", + "test": "pnpm run test:setup && pnpm run --recursive test", + "test:ci": "pnpm run test:setup && pnpm run --recursive test:ci", + "test:setup": "tsx test-setup/startAnvil.ts & pnpm run --filter mock-game-contracts build", "type-bench": "pnpm --filter ./test/ts-benchmarks bench", "type-stats-repo": "attest stats packages/*", "vercel:prepare": "(forge --version || pnpm foundryup) && ln -sf /vercel/.foundry/bin/* node_modules/.bin/ && forge --version" diff --git a/packages/store/package.json b/packages/store/package.json index 3214f3cf36..6378bcf075 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -78,7 +78,6 @@ "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", "solhint": "^3.3.7", - "tsup": "^6.7.0", - "tsx": "^3.12.6" + "tsup": "^6.7.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 403cf9c827..9f3a7afafa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -988,9 +988,6 @@ importers: tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.47)(typescript@5.4.2) - tsx: - specifier: ^3.12.6 - version: 3.12.6 packages/store-indexer: dependencies: