From 24a0dd4440d6fe661640c581ff5348d62eae9302 Mon Sep 17 00:00:00 2001 From: y77cao Date: Mon, 18 Sep 2023 13:22:19 -0400 Subject: [PATCH 1/7] feat(dev-tools): update actions to display function name instead of callFrom (#1497) Co-authored-by: Kevin Ingersoll --- .changeset/blue-seals-relate.md | 5 +++++ .../dev-tools/src/actions/WriteSummary.tsx | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 .changeset/blue-seals-relate.md diff --git a/.changeset/blue-seals-relate.md b/.changeset/blue-seals-relate.md new file mode 100644 index 0000000000..84b94339ee --- /dev/null +++ b/.changeset/blue-seals-relate.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/dev-tools": minor +--- + +Improved rendering of transactions that make calls via World's `call` and `callFrom` methods diff --git a/packages/dev-tools/src/actions/WriteSummary.tsx b/packages/dev-tools/src/actions/WriteSummary.tsx index f7f4dca1a5..42aee498ec 100644 --- a/packages/dev-tools/src/actions/WriteSummary.tsx +++ b/packages/dev-tools/src/actions/WriteSummary.tsx @@ -1,4 +1,4 @@ -import { decodeEventLog, AbiEventSignatureNotFoundError } from "viem"; +import { decodeEventLog, AbiEventSignatureNotFoundError, decodeFunctionData, Hex } from "viem"; import { twMerge } from "tailwind-merge"; import { isDefined } from "@latticexyz/common/utils"; import { PendingIcon } from "../icons/PendingIcon"; @@ -56,6 +56,17 @@ export function WriteSummary({ write }: Props) { .filter(isDefined) : null; + let functionName = write.request.functionName; + let functionArgs = write.request.args; + if (functionName === "call" || functionName === "callFrom") { + const functionSelectorAndArgs: Hex = write.request?.args?.length + ? (write.request.args[write.request.args.length - 1] as Hex) + : `0x`; + const functionData = decodeFunctionData({ abi: worldAbi, data: functionSelectorAndArgs }); + functionName = functionData.functionName; + functionArgs = functionData.args; + } + return (
{ @@ -73,7 +84,10 @@ export function WriteSummary({ write }: Props) { )} >
- {write.request.functionName}({write.request.args?.map((value) => serialize(value)).join(", ")}) + {functionName}({functionArgs?.map((value) => serialize(value)).join(", ")}){" "} + {write.request.functionName !== functionName ? ( + via {write.request.functionName} + ) : null}
{transactionReceipt.status === "fulfilled" ? ( Date: Mon, 18 Sep 2023 21:24:35 +0100 Subject: [PATCH 2/7] docs(faucet): add readme (#1534) --- .changeset/twelve-monkeys-juggle.md | 5 +++++ packages/faucet/README.md | 30 ++++++++++++++++++++++++++++ packages/faucet/bin/faucet-server.ts | 4 +--- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .changeset/twelve-monkeys-juggle.md create mode 100644 packages/faucet/README.md diff --git a/.changeset/twelve-monkeys-juggle.md b/.changeset/twelve-monkeys-juggle.md new file mode 100644 index 0000000000..203bfe6c37 --- /dev/null +++ b/.changeset/twelve-monkeys-juggle.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/faucet": patch +--- + +Added README diff --git a/packages/faucet/README.md b/packages/faucet/README.md new file mode 100644 index 0000000000..a5a5f52850 --- /dev/null +++ b/packages/faucet/README.md @@ -0,0 +1,30 @@ +# faucet + +A minimal Typescript faucet to drip native tokens on Ethereum chains + +## Usage + +Install and run with: + +```sh +npm install @latticexyz/faucet@next +npm faucet-server +``` + +or execute the package bin directly: + +```sh +npx @latticexyz/faucet@next +``` + +## Configuration + +The faucet can configured with the following environment variables: + +| Variable | Description | Default | +| -------------------- | ----------------------------------------------------- | --------- | +| `HOST` | Host that the indexer server listens on | `0.0.0.0` | +| `PORT` | Port that the indexer server listens on | `3001` | +| `RPC_HTTP_URL` | HTTP URL for Ethereum RPC | | +| `FAUCET_PRIVATE_KEY` | Private key of wallet to distribute faucet funds from | | +| `DRIP_AMOUNT_ETHER` | Drip amount in ether | diff --git a/packages/faucet/bin/faucet-server.ts b/packages/faucet/bin/faucet-server.ts index f6a6327a3d..f3edcabe0a 100644 --- a/packages/faucet/bin/faucet-server.ts +++ b/packages/faucet/bin/faucet-server.ts @@ -3,12 +3,10 @@ import "dotenv/config"; import { z } from "zod"; import fastify from "fastify"; import { fastifyTRPCPlugin } from "@trpc/server/adapters/fastify"; -import { ClientConfig, http, parseEther, isHex, createClient } from "viem"; +import { http, parseEther, isHex, createClient } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { AppRouter, createAppRouter } from "../src/createAppRouter"; -import { getChainId } from "viem/actions"; -// TODO: refine zod type to be either CHAIN_ID or RPC_HTTP_URL/RPC_WS_URL const env = z .object({ HOST: z.string().default("0.0.0.0"), From b3c22a183c0b288b9eb1487e4fef125bf7dae915 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 18 Sep 2023 21:25:08 +0100 Subject: [PATCH 3/7] refactor(store-indexer): add readme, refactor common env (#1533) --- .changeset/thin-rice-trade.md | 5 ++ packages/store-indexer/README.md | 53 +++++++++++++++++++ packages/store-indexer/bin/parseEnv.ts | 30 +++++++++++ .../store-indexer/bin/postgres-indexer.ts | 29 +++------- packages/store-indexer/bin/sqlite-indexer.ts | 29 +++------- 5 files changed, 100 insertions(+), 46 deletions(-) create mode 100644 .changeset/thin-rice-trade.md create mode 100644 packages/store-indexer/README.md create mode 100644 packages/store-indexer/bin/parseEnv.ts diff --git a/.changeset/thin-rice-trade.md b/.changeset/thin-rice-trade.md new file mode 100644 index 0000000000..13d4781cbe --- /dev/null +++ b/.changeset/thin-rice-trade.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store-indexer": patch +--- + +Added README and refactored handling of common environment variables diff --git a/packages/store-indexer/README.md b/packages/store-indexer/README.md new file mode 100644 index 0000000000..32630ec56a --- /dev/null +++ b/packages/store-indexer/README.md @@ -0,0 +1,53 @@ +# store-indexer + +A minimal Typescript indexer for [MUD Store](https://mud.dev/store) events (built on [store-sync](https://npmjs.com/package/@latticexyz/store-sync)) + +## Usage + +Install and run with: + +```sh +npm install @latticexyz/store-indexer + +npm sqlite-indexer +# or +npm postgres-indexer +``` + +or execute the one of the package bins directly: + +```sh +npx -p @latticexyz/store-indexer sqlite-indexer +# or +npx -p @latticexyz/store-indexer postgres-indexer +``` + +## Configuration + +Each indexer can be configured with environment variables. + +### Common environment variables + +| Variable | Description | Default | +| ------------------ | ---------------------------------------------------------- | --------- | +| `HOST` | Host that the indexer server listens on | `0.0.0.0` | +| `PORT` | Port that the indexer server listens on | `3001` | +| `RPC_HTTP_URL` | HTTP URL for Ethereum RPC to fetch data from | | +| `RPC_WS_URL` | WebSocket URL for Ethereum RPC to fetch data from | | +| `START_BLOCK` | Block number to start indexing from | `0` | +| `MAX_BLOCK_RANGE` | Maximum number of blocks to fetch from the RPC per request | `1000` | +| `POLLING_INTERVAL` | How often to poll for new blocks (in milliseconds) | `1000` | + +Note that you only need one of `RPC_HTTP_URL` or `RPC_WS_URL`, but we recommend both. The WebSocket URL will be prioritized and fall back to the HTTP URL if there are any connection issues. + +### Postgres indexer environment variables + +| Variable | Description | Default | +| -------------- | ----------------------- | ------- | +| `DATABASE_URL` | Postgres connection URL | | + +### SQLite indexer environment variables + +| Variable | Description | Default | +| ----------------- | ------------------------ | ------------ | +| `SQLITE_FILENAME` | SQLite database filename | `indexer.db` | diff --git a/packages/store-indexer/bin/parseEnv.ts b/packages/store-indexer/bin/parseEnv.ts new file mode 100644 index 0000000000..b4c3803b23 --- /dev/null +++ b/packages/store-indexer/bin/parseEnv.ts @@ -0,0 +1,30 @@ +import { isDefined } from "@latticexyz/common/utils"; +import { z, ZodIntersection, ZodTypeAny } from "zod"; + +const commonSchema = z.intersection( + z.object({ + HOST: z.string().default("0.0.0.0"), + PORT: z.coerce.number().positive().default(3001), + START_BLOCK: z.coerce.bigint().nonnegative().default(0n), + MAX_BLOCK_RANGE: z.coerce.bigint().positive().default(1000n), + POLLING_INTERVAL: z.coerce.number().positive().default(1000), + }), + z + .object({ + RPC_HTTP_URL: z.string(), + RPC_WS_URL: z.string(), + }) + .partial() + .refine((values) => Object.values(values).some(isDefined)) +); + +export function parseEnv( + schema?: TSchema +): z.infer : typeof commonSchema> { + const envSchema = schema !== undefined ? z.intersection(commonSchema, schema) : commonSchema; + return envSchema.parse(process.env, { + errorMap: (issue) => ({ + message: `Missing or invalid environment variable: ${issue.path.join(".")}`, + }), + }); +} diff --git a/packages/store-indexer/bin/postgres-indexer.ts b/packages/store-indexer/bin/postgres-indexer.ts index b2b7068276..3a0428684a 100644 --- a/packages/store-indexer/bin/postgres-indexer.ts +++ b/packages/store-indexer/bin/postgres-indexer.ts @@ -13,30 +13,13 @@ import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import { cleanDatabase, postgresStorage, schemaVersion } from "@latticexyz/store-sync/postgres"; import { createStoreSync } from "@latticexyz/store-sync"; +import { parseEnv } from "./parseEnv"; -const env = z - .intersection( - z.object({ - HOST: z.string().default("0.0.0.0"), - PORT: z.coerce.number().positive().default(3001), - DATABASE_URL: z.string(), - START_BLOCK: z.coerce.bigint().nonnegative().default(0n), - MAX_BLOCK_RANGE: z.coerce.bigint().positive().default(1000n), - POLLING_INTERVAL: z.coerce.number().positive().default(1000), - }), - z - .object({ - RPC_HTTP_URL: z.string(), - RPC_WS_URL: z.string(), - }) - .partial() - .refine((values) => Object.values(values).some(isDefined)) - ) - .parse(process.env, { - errorMap: (issue) => ({ - message: `Missing or invalid environment variable: ${issue.path.join(".")}`, - }), - }); +const env = parseEnv( + z.object({ + DATABASE_URL: z.string(), + }) +); const transports: Transport[] = [ // prefer WS when specified diff --git a/packages/store-indexer/bin/sqlite-indexer.ts b/packages/store-indexer/bin/sqlite-indexer.ts index 483dc9a823..afa4ab97bb 100644 --- a/packages/store-indexer/bin/sqlite-indexer.ts +++ b/packages/store-indexer/bin/sqlite-indexer.ts @@ -13,30 +13,13 @@ import { chainState, schemaVersion, syncToSqlite } from "@latticexyz/store-sync/ import { createQueryAdapter } from "../src/sqlite/createQueryAdapter"; import { isDefined } from "@latticexyz/common/utils"; import { combineLatest, filter, first } from "rxjs"; +import { parseEnv } from "./parseEnv"; -const env = z - .intersection( - z.object({ - HOST: z.string().default("0.0.0.0"), - PORT: z.coerce.number().positive().default(3001), - SQLITE_FILENAME: z.string().default("indexer.db"), - START_BLOCK: z.coerce.bigint().nonnegative().default(0n), - MAX_BLOCK_RANGE: z.coerce.bigint().positive().default(1000n), - POLLING_INTERVAL: z.coerce.number().positive().default(1000), - }), - z - .object({ - RPC_HTTP_URL: z.string(), - RPC_WS_URL: z.string(), - }) - .partial() - .refine((values) => Object.values(values).some(isDefined)) - ) - .parse(process.env, { - errorMap: (issue) => ({ - message: `Missing or invalid environment variable: ${issue.path.join(".")}`, - }), - }); +const env = parseEnv( + z.object({ + SQLITE_FILENAME: z.string().default("indexer.db"), + }) +); const transports: Transport[] = [ // prefer WS when specified From e23de32f573bf112e2973459a16bad5fb1a53c60 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 18 Sep 2023 21:48:26 +0100 Subject: [PATCH 4/7] build: pin react/react-dom types versions (#1541) --- .../packages/client-phaser/package.json | 4 +-- .../packages/client-react/package.json | 4 +-- examples/minimal/pnpm-lock.yaml | 30 +++++++++---------- packages/dev-tools/package.json | 4 +-- packages/react/package.json | 2 +- pnpm-lock.yaml | 28 ++++++++--------- templates/phaser/packages/client/package.json | 4 +-- templates/react/packages/client/package.json | 4 +-- .../threejs/packages/client/package.json | 4 +-- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/minimal/packages/client-phaser/package.json b/examples/minimal/packages/client-phaser/package.json index d3799d9672..d89bea645a 100644 --- a/examples/minimal/packages/client-phaser/package.json +++ b/examples/minimal/packages/client-phaser/package.json @@ -40,8 +40,8 @@ "zustand": "^4.3.8" }, "devDependencies": { - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@types/styled-components": "^5.1.26", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", diff --git a/examples/minimal/packages/client-react/package.json b/examples/minimal/packages/client-react/package.json index 0b69a60485..eb739ab293 100644 --- a/examples/minimal/packages/client-react/package.json +++ b/examples/minimal/packages/client-react/package.json @@ -35,8 +35,8 @@ "viem": "1.6.0" }, "devDependencies": { - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@vitejs/plugin-react": "^3.1.0", "eslint-plugin-react": "7.31.11", "eslint-plugin-react-hooks": "4.6.0", diff --git a/examples/minimal/pnpm-lock.yaml b/examples/minimal/pnpm-lock.yaml index 7f09b57e02..f480d20160 100644 --- a/examples/minimal/pnpm-lock.yaml +++ b/examples/minimal/pnpm-lock.yaml @@ -112,11 +112,11 @@ importers: version: 4.3.8(react@18.2.0) devDependencies: '@types/react': - specifier: ^18.2.6 - version: 18.2.6 + specifier: 18.2.22 + version: 18.2.22 '@types/react-dom': - specifier: ^18.2.4 - version: 18.2.4 + specifier: 18.2.7 + version: 18.2.7 '@types/styled-components': specifier: ^5.1.26 version: 5.1.26 @@ -209,11 +209,11 @@ importers: version: 1.6.0(typescript@5.1.6) devDependencies: '@types/react': - specifier: ^18.2.6 - version: 18.2.6 + specifier: 18.2.22 + version: 18.2.22 '@types/react-dom': - specifier: ^18.2.4 - version: 18.2.4 + specifier: 18.2.7 + version: 18.2.7 '@vitejs/plugin-react': specifier: ^3.1.0 version: 3.1.0(vite@4.2.1) @@ -1072,7 +1072,7 @@ packages: /@types/hoist-non-react-statics@3.3.1: resolution: {integrity: sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==} dependencies: - '@types/react': 18.2.6 + '@types/react': 18.2.22 hoist-non-react-statics: 3.3.2 dev: true @@ -1091,14 +1091,14 @@ packages: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true - /@types/react-dom@18.2.4: - resolution: {integrity: sha512-G2mHoTMTL4yoydITgOGwWdWMVd8sNgyEP85xVmMKAPUBwQWm9wBPQUmvbeF4V3WBY1P7mmL4BkjQ0SqUpf1snw==} + /@types/react-dom@18.2.7: + resolution: {integrity: sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==} dependencies: - '@types/react': 18.2.6 + '@types/react': 18.2.22 dev: true - /@types/react@18.2.6: - resolution: {integrity: sha512-wRZClXn//zxCFW+ye/D2qY65UsYP1Fpex2YXorHc8awoNamkMZSvBxwxdYVInsHOZZd2Ppq8isnSzJL5Mpf8OA==} + /@types/react@18.2.22: + resolution: {integrity: sha512-60fLTOLqzarLED2O3UQImc/lsNRgG0jE/a1mPW9KjMemY0LMITWEsbS4VvZ4p6rorEHd5YKxxmMKSDK505GHpA==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.3 @@ -1117,7 +1117,7 @@ packages: resolution: {integrity: sha512-KuKJ9Z6xb93uJiIyxo/+ksS7yLjS1KzG6iv5i78dhVg/X3u5t1H7juRWqVmodIdz6wGVaIApo1u01kmFRdJHVw==} dependencies: '@types/hoist-non-react-statics': 3.3.1 - '@types/react': 18.2.6 + '@types/react': 18.2.22 csstype: 3.1.2 dev: true diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index c1af28ac22..26e18693d9 100644 --- a/packages/dev-tools/package.json +++ b/packages/dev-tools/package.json @@ -41,8 +41,8 @@ "zustand": "^4.3.7" }, "devDependencies": { - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@types/ws": "^8.5.4", "autoprefixer": "^10.4.14", "postcss": "^8.4.23", diff --git a/packages/react/package.json b/packages/react/package.json index 3fedb5d19b..394951f492 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@testing-library/react-hooks": "^8.0.1", - "@types/react": "^18.2.6", + "@types/react": "18.2.22", "@vitejs/plugin-react": "^4.0.0", "eslint-plugin-react": "7.31.11", "eslint-plugin-react-hooks": "4.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 077747e8e9..bbdbb441ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -379,11 +379,11 @@ importers: version: 4.3.7(react@18.2.0) devDependencies: '@types/react': - specifier: ^18.2.6 - version: 18.2.6 + specifier: 18.2.22 + version: 18.2.22 '@types/react-dom': - specifier: ^18.2.4 - version: 18.2.4 + specifier: 18.2.7 + version: 18.2.7 '@types/ws': specifier: ^8.5.4 version: 8.5.4 @@ -600,10 +600,10 @@ importers: devDependencies: '@testing-library/react-hooks': specifier: ^8.0.1 - version: 8.0.1(@types/react@18.2.6)(react-test-renderer@18.2.0)(react@18.2.0) + version: 8.0.1(@types/react@18.2.22)(react-test-renderer@18.2.0)(react@18.2.0) '@types/react': - specifier: ^18.2.6 - version: 18.2.6 + specifier: 18.2.22 + version: 18.2.22 '@vitejs/plugin-react': specifier: ^4.0.0 version: 4.0.0(vite@4.3.6) @@ -3029,7 +3029,7 @@ packages: antlr4ts: 0.5.0-alpha.4 dev: false - /@testing-library/react-hooks@8.0.1(@types/react@18.2.6)(react-test-renderer@18.2.0)(react@18.2.0): + /@testing-library/react-hooks@8.0.1(@types/react@18.2.22)(react-test-renderer@18.2.0)(react@18.2.0): resolution: {integrity: sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g==} engines: {node: '>=12'} peerDependencies: @@ -3046,7 +3046,7 @@ packages: optional: true dependencies: '@babel/runtime': 7.21.0 - '@types/react': 18.2.6 + '@types/react': 18.2.22 react: 18.2.0 react-error-boundary: 3.1.4(react@18.2.0) react-test-renderer: 18.2.0(react@18.2.0) @@ -3282,14 +3282,14 @@ packages: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true - /@types/react-dom@18.2.4: - resolution: {integrity: sha512-G2mHoTMTL4yoydITgOGwWdWMVd8sNgyEP85xVmMKAPUBwQWm9wBPQUmvbeF4V3WBY1P7mmL4BkjQ0SqUpf1snw==} + /@types/react-dom@18.2.7: + resolution: {integrity: sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==} dependencies: - '@types/react': 18.2.6 + '@types/react': 18.2.22 dev: true - /@types/react@18.2.6: - resolution: {integrity: sha512-wRZClXn//zxCFW+ye/D2qY65UsYP1Fpex2YXorHc8awoNamkMZSvBxwxdYVInsHOZZd2Ppq8isnSzJL5Mpf8OA==} + /@types/react@18.2.22: + resolution: {integrity: sha512-60fLTOLqzarLED2O3UQImc/lsNRgG0jE/a1mPW9KjMemY0LMITWEsbS4VvZ4p6rorEHd5YKxxmMKSDK505GHpA==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.3 diff --git a/templates/phaser/packages/client/package.json b/templates/phaser/packages/client/package.json index 9bc539ac0f..4692415744 100644 --- a/templates/phaser/packages/client/package.json +++ b/templates/phaser/packages/client/package.json @@ -34,8 +34,8 @@ }, "devDependencies": { "@types/lodash": "^4.14.194", - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@types/styled-components": "^5.1.26", "@vitejs/plugin-react": "^3.1.0", "eslint-plugin-react": "7.31.11", diff --git a/templates/react/packages/client/package.json b/templates/react/packages/client/package.json index 7328d90df6..1855fbf09e 100644 --- a/templates/react/packages/client/package.json +++ b/templates/react/packages/client/package.json @@ -27,8 +27,8 @@ "viem": "1.6.0" }, "devDependencies": { - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@vitejs/plugin-react": "^3.1.0", "eslint-plugin-react": "7.31.11", "eslint-plugin-react-hooks": "4.6.0", diff --git a/templates/threejs/packages/client/package.json b/templates/threejs/packages/client/package.json index 030dce939d..ee97435dd0 100644 --- a/templates/threejs/packages/client/package.json +++ b/templates/threejs/packages/client/package.json @@ -28,8 +28,8 @@ "viem": "1.6.0" }, "devDependencies": { - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "18.2.22", + "@types/react-dom": "18.2.7", "@vitejs/plugin-react": "^3.1.0", "eslint-plugin-react": "7.31.11", "eslint-plugin-react-hooks": "4.6.0", From 2764ffdd170a7c8d01e7a84fea3e945adf9ffda8 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 18 Sep 2023 21:49:05 +0100 Subject: [PATCH 5/7] refactor(store): remove unused enum (#1539) --- packages/store/src/Types.sol | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 packages/store/src/Types.sol diff --git a/packages/store/src/Types.sol b/packages/store/src/Types.sol deleted file mode 100644 index 5dc3f4b242..0000000000 --- a/packages/store/src/Types.sol +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -enum ExecutionMode { - Delegate, - Autonomous -} From ae13eb8814e6ebcef2151e76b9e373260d14e1b8 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 18 Sep 2023 22:09:54 +0100 Subject: [PATCH 6/7] refactor(world): use abi.encodeCall instead of abi.encodeWithSelector (#1528) --- packages/world/gas-report.json | 32 ++++----- packages/world/src/Delegation.sol | 2 +- packages/world/src/World.sol | 2 +- .../src/interfaces/IDelegationControl.sol | 2 +- .../ModuleInstallationSystem.sol | 2 +- .../StoreRegistrationSystem.sol | 2 +- .../test/StandardDelegationsModule.t.sol | 21 +++--- packages/world/test/Utils.t.sol | 2 +- packages/world/test/World.t.sol | 71 +++++++------------ packages/world/test/WorldContext.t.sol | 4 +- 10 files changed, 60 insertions(+), 80 deletions(-) diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index f4ba05a6c7..fe406020c8 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -39,13 +39,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1415024 + "gasUsed": 1414994 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1415024 + "gasUsed": 1414994 }, { "file": "test/KeysInTableModule.t.sol", @@ -57,13 +57,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1415024 + "gasUsed": 1414994 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1415024 + "gasUsed": 1414994 }, { "file": "test/KeysInTableModule.t.sol", @@ -81,7 +81,7 @@ "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1415024 + "gasUsed": 1414994 }, { "file": "test/KeysInTableModule.t.sol", @@ -99,7 +99,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 654245 + "gasUsed": 654197 }, { "file": "test/KeysWithValueModule.t.sol", @@ -117,7 +117,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 654245 + "gasUsed": 654197 }, { "file": "test/KeysWithValueModule.t.sol", @@ -129,7 +129,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 654245 + "gasUsed": 654197 }, { "file": "test/KeysWithValueModule.t.sol", @@ -147,7 +147,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 654245 + "gasUsed": 654197 }, { "file": "test/KeysWithValueModule.t.sol", @@ -231,31 +231,31 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "register a callbound delegation", - "gasUsed": 113953 + "gasUsed": 113920 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "call a system via a callbound delegation", - "gasUsed": 33584 + "gasUsed": 33554 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "register a timebound delegation", - "gasUsed": 108390 + "gasUsed": 108384 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "call a system via a timebound delegation", - "gasUsed": 26696 + "gasUsed": 26666 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 678930 + "gasUsed": 678867 }, { "file": "test/UniqueEntityModule.t.sol", @@ -267,7 +267,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 668988 + "gasUsed": 668940 }, { "file": "test/UniqueEntityModule.t.sol", @@ -339,7 +339,7 @@ "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 641613 + "gasUsed": 641595 }, { "file": "test/World.t.sol", diff --git a/packages/world/src/Delegation.sol b/packages/world/src/Delegation.sol index 8a4a0b9b8e..14855a1ae0 100644 --- a/packages/world/src/Delegation.sol +++ b/packages/world/src/Delegation.sol @@ -44,7 +44,7 @@ library DelegationInstance { (bool success, bytes memory data) = SystemCall.call({ caller: delegatee, resourceSelector: Delegation.unwrap(self), - callData: abi.encodeWithSelector(IDelegationControl.verify.selector, delegator, systemId, callData), + callData: abi.encodeCall(IDelegationControl.verify, (delegator, systemId, callData)), value: 0 }); diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 7b61f52e0e..15315eec16 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -85,7 +85,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { msgSender: msg.sender, msgValue: 0, target: address(module), - callData: abi.encodeWithSelector(IModule.installRoot.selector, args) + callData: abi.encodeCall(IModule.installRoot, (args)) }); // Register the module in the InstalledModules table diff --git a/packages/world/src/interfaces/IDelegationControl.sol b/packages/world/src/interfaces/IDelegationControl.sol index 3f77f24632..6f68af9b32 100644 --- a/packages/world/src/interfaces/IDelegationControl.sol +++ b/packages/world/src/interfaces/IDelegationControl.sol @@ -8,5 +8,5 @@ bytes4 constant DELEGATION_CONTROL_INTERFACE_ID = IDelegationControl.verify.sele WORLD_CONTEXT_CONSUMER_INTERFACE_ID; interface IDelegationControl is IWorldContextConsumer { - function verify(address delegator, bytes32 systemId, bytes calldata callData) external returns (bool); + function verify(address delegator, bytes32 systemId, bytes memory callData) external returns (bool); } diff --git a/packages/world/src/modules/core/implementations/ModuleInstallationSystem.sol b/packages/world/src/modules/core/implementations/ModuleInstallationSystem.sol index 527cf62eba..dfa2fa6fa4 100644 --- a/packages/world/src/modules/core/implementations/ModuleInstallationSystem.sol +++ b/packages/world/src/modules/core/implementations/ModuleInstallationSystem.sol @@ -24,7 +24,7 @@ contract ModuleInstallationSystem is System { msgSender: _msgSender(), msgValue: 0, target: address(module), - callData: abi.encodeWithSelector(IModule.install.selector, args) + callData: abi.encodeCall(IModule.install, (args)) }); // Register the module in the InstalledModules table diff --git a/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol b/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol index f51e198b4a..f79d328b9c 100644 --- a/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol +++ b/packages/world/src/modules/core/implementations/StoreRegistrationSystem.sol @@ -57,7 +57,7 @@ contract StoreRegistrationSystem is System, IWorldErrors { msgSender: _msgSender(), msgValue: 0, target: systemAddress, - callData: abi.encodeWithSelector(WorldRegistrationSystem.registerNamespace.selector, namespace) + callData: abi.encodeCall(WorldRegistrationSystem.registerNamespace, (namespace)) }); } else { // otherwise require caller to own the namespace diff --git a/packages/world/test/StandardDelegationsModule.t.sol b/packages/world/test/StandardDelegationsModule.t.sol index 72b83642d8..28006e43c4 100644 --- a/packages/world/test/StandardDelegationsModule.t.sol +++ b/packages/world/test/StandardDelegationsModule.t.sol @@ -42,12 +42,9 @@ contract StandardDelegationsModuleTest is Test, GasReporter { world.registerDelegation( delegatee, CALLBOUND_DELEGATION, - abi.encodeWithSelector( - CallboundDelegationControl.initDelegation.selector, - delegatee, - systemResourceSelector, - abi.encodeWithSelector(WorldTestSystem.msgSender.selector), - 1 + abi.encodeCall( + CallboundDelegationControl.initDelegation, + (delegatee, systemResourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ()), 1) ) ); endGasReport(); @@ -58,7 +55,7 @@ contract StandardDelegationsModuleTest is Test, GasReporter { bytes memory returnData = world.callFrom( delegator, systemResourceSelector, - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) + abi.encodeCall(WorldTestSystem.msgSender, ()) ); endGasReport(); address returnedAddress = abi.decode(returnData, (address)); @@ -69,7 +66,7 @@ contract StandardDelegationsModuleTest is Test, GasReporter { // Expect the delegation to have been used up vm.prank(delegatee); vm.expectRevert(abi.encodeWithSelector(IWorldErrors.DelegationNotFound.selector, delegator, delegatee)); - world.callFrom(delegator, systemResourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.callFrom(delegator, systemResourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); } function testCallFromTimeboundDelegation() public { @@ -84,7 +81,7 @@ contract StandardDelegationsModuleTest is Test, GasReporter { world.registerDelegation( delegatee, TIMEBOUND_DELEGATION, - abi.encodeWithSelector(TimeboundDelegationControl.initDelegation.selector, delegatee, maxTimestamp) + abi.encodeCall(TimeboundDelegationControl.initDelegation, (delegatee, maxTimestamp)) ); endGasReport(); @@ -94,7 +91,7 @@ contract StandardDelegationsModuleTest is Test, GasReporter { bytes memory returnData = world.callFrom( delegator, systemResourceSelector, - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) + abi.encodeCall(WorldTestSystem.msgSender, ()) ); endGasReport(); address returnedAddress = abi.decode(returnData, (address)); @@ -105,13 +102,13 @@ contract StandardDelegationsModuleTest is Test, GasReporter { // Set the timestamp to maxTimestamp and expect the delegation to still be valid vm.warp(maxTimestamp); vm.prank(delegatee); - world.callFrom(delegator, systemResourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.callFrom(delegator, systemResourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); // Set the timestamp to maxTimestamp+1 and expect the delegation to be expired vm.warp(maxTimestamp + 1); vm.prank(delegatee); vm.expectRevert(abi.encodeWithSelector(IWorldErrors.DelegationNotFound.selector, delegator, delegatee)); - world.callFrom(delegator, systemResourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.callFrom(delegator, systemResourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); } function testRegisterDelegationRevertInterfaceNotSupported() public { diff --git a/packages/world/test/Utils.t.sol b/packages/world/test/Utils.t.sol index de0acda0d0..d3def80af0 100644 --- a/packages/world/test/Utils.t.sol +++ b/packages/world/test/Utils.t.sol @@ -35,7 +35,7 @@ contract UtilsTest is Test { bytes memory data = world.call( ResourceSelector.from(namespace, name), - abi.encodeWithSelector(UtilsTestSystem.systemNamespace.selector) + abi.encodeCall(UtilsTestSystem.systemNamespace, ()) ); returnedNamespace = abi.decode(data, (bytes16)); } diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 4e1038c93c..6150e2b751 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -276,10 +276,7 @@ contract WorldTest is Test, GasReporter { bytes32 resourceSelector = ResourceSelector.from("namespace", "testSystem"); world.registerSystem(resourceSelector, system, false); - bytes memory result = world.call( - resourceSelector, - abi.encodeWithSelector(WorldTestSystem.getStoreAddress.selector) - ); + bytes memory result = world.call(resourceSelector, abi.encodeCall(WorldTestSystem.getStoreAddress, ())); assertEq(abi.decode(result, (address)), address(world)); } @@ -684,17 +681,14 @@ contract WorldTest is Test, GasReporter { // Call a system function without arguments via the World startGasReport("call a system via the World"); - bytes memory result = world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + bytes memory result = world.call(resourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); endGasReport(); // Expect the system to have received the caller's address assertEq(address(uint160(uint256(bytes32(result)))), address(this)); // Call a system function with arguments via the World - result = world.call( - resourceSelector, - abi.encodeWithSelector(WorldTestSystem.echo.selector, bytes32(uint256(0x123))) - ); + result = world.call(resourceSelector, abi.encodeCall(WorldTestSystem.echo, (bytes32(uint256(0x123))))); // Expect the return data to be decodeable as a tuple (address returnedAddress, bytes32 returnedBytes32) = abi.decode(result, (address, bytes32)); @@ -708,15 +702,15 @@ contract WorldTest is Test, GasReporter { // Expect an error when trying to call a private system from an address that doesn't have access _expectAccessDenied(address(0x01), "namespace", "testSystem"); - world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.call(resourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); // Expect the World to have access vm.prank(address(world)); - world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.call(resourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); // Expect errors from the system to be forwarded vm.expectRevert(abi.encodeWithSelector(WorldTestSystem.WorldTestSystemError.selector, "test error")); - world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.err.selector, "test error")); + world.call(resourceSelector, abi.encodeCall(WorldTestSystem.err, ("test error"))); // Register another system in the same namespace WorldTestSystem subSystem = new WorldTestSystem(); @@ -725,7 +719,7 @@ contract WorldTest is Test, GasReporter { // Call the subsystem via the World (with access to the base route) returnedAddress = abi.decode( - world.call(subsystemResourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)), + world.call(subsystemResourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())), (address) ); assertEq(returnedAddress, address(this)); @@ -734,14 +728,16 @@ contract WorldTest is Test, GasReporter { // (Note: just for testing purposes, in reality systems can call subsystems directly instead of via two indirections like here) bytes memory nestedReturndata = world.call( resourceSelector, - abi.encodeWithSelector( - WorldTestSystem.delegateCallSubSystem.selector, // Function in system - address(subSystem), // Address of subsystem - WorldContextProvider.appendContext({ - callData: abi.encodeWithSelector(WorldTestSystem.msgSender.selector), - msgSender: address(this), - msgValue: uint256(0) - }) + abi.encodeCall( + WorldTestSystem.delegateCallSubSystem, // Function in system + ( + address(subSystem), // Address of subsystem + WorldContextProvider.appendContext({ + callData: abi.encodeCall(WorldTestSystem.msgSender, ()), + msgSender: address(this), + msgValue: uint256(0) + }) + ) ) ); @@ -759,11 +755,7 @@ contract WorldTest is Test, GasReporter { // Call a system via callFrom with the own address vm.prank(caller); - bytes memory returnData = world.callFrom( - caller, - resourceSelector, - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) - ); + bytes memory returnData = world.callFrom(caller, resourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); address returnedAddress = abi.decode(returnData, (address)); // Expect the system to have received the delegator's address @@ -790,7 +782,7 @@ contract WorldTest is Test, GasReporter { bytes memory returnData = world.callFrom( delegator, resourceSelector, - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) + abi.encodeCall(WorldTestSystem.msgSender, ()) ); endGasReport(); address returnedAddress = abi.decode(returnData, (address)); @@ -814,7 +806,7 @@ contract WorldTest is Test, GasReporter { ) ); vm.prank(address(1)); - world.callFrom(address(2), resourceSelector, abi.encodeWithSelector(WorldTestSystem.msgSender.selector)); + world.callFrom(address(2), resourceSelector, abi.encodeCall(WorldTestSystem.msgSender, ())); } function testCallFromLimitedDelegation() public { @@ -1079,7 +1071,7 @@ contract WorldTest is Test, GasReporter { // Call a system function that writes data to the World world.call( rootSystemId, - abi.encodeWithSelector(WorldTestSystem.writeData.selector, bytes16("namespace"), bytes16("testTable"), true) + abi.encodeCall(WorldTestSystem.writeData, (bytes16("namespace"), bytes16("testTable"), true)) ); // Expect the data to be written @@ -1104,10 +1096,7 @@ contract WorldTest is Test, GasReporter { world.registerSystem(systemId, system, false); // Call a system function that writes data to the World - world.call( - systemId, - abi.encodeWithSelector(WorldTestSystem.writeData.selector, bytes16("namespace"), bytes16("testTable"), true) - ); + world.call(systemId, abi.encodeCall(WorldTestSystem.writeData, (bytes16("namespace"), bytes16("testTable"), true))); // Expect the data to be written assertTrue(Bool.get(world, tableId)); @@ -1122,7 +1111,7 @@ contract WorldTest is Test, GasReporter { // Call the root sysyem vm.expectEmit(true, true, true, true); emit WorldTestSystemLog("delegatecall"); - world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); + world.call(resourceSelector, abi.encodeCall(WorldTestSystem.emitCallType, ())); } function testCallAutonomousSystem() public { @@ -1134,7 +1123,7 @@ contract WorldTest is Test, GasReporter { // Call the sysyem vm.expectEmit(true, true, true, true); emit WorldTestSystemLog("call"); - world.call(resourceSelector, abi.encodeWithSelector(WorldTestSystem.emitCallType.selector)); + world.call(resourceSelector, abi.encodeCall(WorldTestSystem.emitCallType, ())); } function testRegisterFunctionSelector() public { @@ -1291,9 +1280,7 @@ contract WorldTest is Test, GasReporter { assertEq(address(system).balance, 0); // Send 0.5 eth to the system's receiveEther function via the World - (bool success, ) = address(world).call{ value: 0.5 ether }( - abi.encodeWithSelector(WorldTestSystem.receiveEther.selector) - ); + (bool success, ) = address(world).call{ value: 0.5 ether }(abi.encodeCall(WorldTestSystem.receiveEther, ())); assertTrue(success, "transfer should succeed"); assertEq(alice.balance, 0.5 ether, "alice should have 0.5 ether"); assertEq(address(world).balance, 0.5 ether, "world should have 0.5 ether"); @@ -1323,9 +1310,7 @@ contract WorldTest is Test, GasReporter { assertEq(address(system).balance, 0); // Send 0.5 eth to the system's msgSender function (non-payable) via the World - (bool success, ) = address(world).call{ value: 0.5 ether }( - abi.encodeWithSelector(WorldTestSystem.msgSender.selector) - ); + (bool success, ) = address(world).call{ value: 0.5 ether }(abi.encodeCall(WorldTestSystem.msgSender, ())); // The call should succeed because the value is not forwarded to the system assertTrue(success, "transfer should succeed"); assertEq(alice.balance, 0.5 ether, "alice should have 0.5 ether"); @@ -1416,9 +1401,7 @@ contract WorldTest is Test, GasReporter { assertEq(address(system).balance, 0); // Send 0.5 eth to the system's receiveEther function via the World - (bool success, ) = address(world).call{ value: 0.5 ether }( - abi.encodeWithSelector(WorldTestSystem.receiveEther.selector) - ); + (bool success, ) = address(world).call{ value: 0.5 ether }(abi.encodeCall(WorldTestSystem.receiveEther, ())); assertTrue(success, "transfer should succeed"); assertEq(alice.balance, 0.5 ether, "alice should have 0.5 ether"); assertEq(address(world).balance, 0.5 ether, "world should have 0.5 ether"); diff --git a/packages/world/test/WorldContext.t.sol b/packages/world/test/WorldContext.t.sol index 174c90bfd3..a264b510b0 100644 --- a/packages/world/test/WorldContext.t.sol +++ b/packages/world/test/WorldContext.t.sol @@ -34,7 +34,7 @@ contract WorldContextTest is Test, GasReporter { msgSender: msgSender, msgValue: msgValue, target: address(consumer), - callData: abi.encodeWithSelector(TestContextConsumer.emitContext.selector, args) + callData: abi.encodeCall(TestContextConsumer.emitContext, (args)) }); } @@ -47,7 +47,7 @@ contract WorldContextTest is Test, GasReporter { msgSender: msgSender, msgValue: msgValue, target: address(consumer), - callData: abi.encodeWithSelector(TestContextConsumer.emitContext.selector, args) + callData: abi.encodeCall(TestContextConsumer.emitContext, (args)) }); } } From b5540716bc29eed6061328a716a9b0e5387263bf Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 18 Sep 2023 22:19:29 +0100 Subject: [PATCH 7/7] refactor(cli,world): clean up unused solidity (#1543) --- packages/cli/contracts/src/codegen/Tables.sol | 10 -------- packages/cli/contracts/src/codegen/Types.sol | 13 ----------- packages/world/src/Tables.sol | 23 ------------------- packages/world/src/Types.sol | 10 -------- packages/world/src/Utils.sol | 2 +- 5 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 packages/cli/contracts/src/codegen/Tables.sol delete mode 100644 packages/cli/contracts/src/codegen/Types.sol delete mode 100644 packages/world/src/Tables.sol delete mode 100644 packages/world/src/Types.sol diff --git a/packages/cli/contracts/src/codegen/Tables.sol b/packages/cli/contracts/src/codegen/Tables.sol deleted file mode 100644 index de034e0789..0000000000 --- a/packages/cli/contracts/src/codegen/Tables.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/* Autogenerated file. Do not edit manually. */ - -import { Statics, StaticsData, StaticsTableId } from "./tables/Statics.sol"; -import { Dynamics1, Dynamics1Data, Dynamics1TableId } from "./tables/Dynamics1.sol"; -import { Dynamics2, Dynamics2Data, Dynamics2TableId } from "./tables/Dynamics2.sol"; -import { Singleton, SingletonTableId } from "./tables/Singleton.sol"; -import { Ephemeral, EphemeralTableId } from "./tables/Ephemeral.sol"; diff --git a/packages/cli/contracts/src/codegen/Types.sol b/packages/cli/contracts/src/codegen/Types.sol deleted file mode 100644 index 85fa534462..0000000000 --- a/packages/cli/contracts/src/codegen/Types.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/* Autogenerated file. Do not edit manually. */ -enum Enum1 { - E1, - E2, - E3 -} - -enum Enum2 { - E1 -} diff --git a/packages/world/src/Tables.sol b/packages/world/src/Tables.sol deleted file mode 100644 index 021a7371bf..0000000000 --- a/packages/world/src/Tables.sol +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/* Autogenerated file. Do not edit manually. */ - -import { NamespaceOwner, NamespaceOwnerTableId } from "./tables/NamespaceOwner.sol"; -import { ResourceAccess, ResourceAccessTableId } from "./tables/ResourceAccess.sol"; -import { InstalledModules, InstalledModulesTableId } from "./tables/InstalledModules.sol"; -import { Delegations, DelegationsTableId } from "./tables/Delegations.sol"; -import { Balances, BalancesTableId } from "./modules/core/tables/Balances.sol"; -import { Systems, SystemsTableId } from "./modules/core/tables/Systems.sol"; -import { SystemRegistry, SystemRegistryTableId } from "./modules/core/tables/SystemRegistry.sol"; -import { SystemHooks, SystemHooksTableId } from "./modules/core/tables/SystemHooks.sol"; -import { ResourceType, ResourceTypeTableId } from "./modules/core/tables/ResourceType.sol"; -import { FunctionSelectors, FunctionSelectorsTableId } from "./modules/core/tables/FunctionSelectors.sol"; -import { KeysWithValue } from "./modules/keyswithvalue/tables/KeysWithValue.sol"; -import { KeysInTable, KeysInTableData, KeysInTableTableId } from "./modules/keysintable/tables/KeysInTable.sol"; -import { UsedKeysIndex, UsedKeysIndexTableId } from "./modules/keysintable/tables/UsedKeysIndex.sol"; -import { UniqueEntity } from "./modules/uniqueentity/tables/UniqueEntity.sol"; -import { CallboundDelegations, CallboundDelegationsTableId } from "./modules/std-delegations/tables/CallboundDelegations.sol"; -import { TimeboundDelegations, TimeboundDelegationsTableId } from "./modules/std-delegations/tables/TimeboundDelegations.sol"; -import { Bool } from "./../test/tables/Bool.sol"; -import { AddressArray } from "./../test/tables/AddressArray.sol"; diff --git a/packages/world/src/Types.sol b/packages/world/src/Types.sol deleted file mode 100644 index 6c4b0ff193..0000000000 --- a/packages/world/src/Types.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; - -/* Autogenerated file. Do not edit manually. */ -enum Resource { - NONE, - NAMESPACE, - TABLE, - SYSTEM -} diff --git a/packages/world/src/Utils.sol b/packages/world/src/Utils.sol index dd5a4138dc..b54e5d7653 100644 --- a/packages/world/src/Utils.sol +++ b/packages/world/src/Utils.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; import { ResourceSelector } from "./ResourceSelector.sol"; -import { SystemRegistry } from "./Tables.sol"; +import { SystemRegistry } from "./index.sol"; library Utils { /**