From 6202194568452fa3a4119ac90cebc409d770a5e1 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 14 May 2024 16:55:14 +0100 Subject: [PATCH] remove more usages --- e2e/packages/client-vanilla/package.json | 1 - .../src/mud/getNetworkConfig.ts | 1 - .../client-vanilla/src/mud/setupNetwork.ts | 27 +--------------- e2e/pnpm-lock.yaml | 3 -- .../packages/client-phaser/package.json | 1 - .../client-phaser/src/mud/getNetworkConfig.ts | 1 - .../client-phaser/src/mud/setupNetwork.ts | 27 +--------------- .../packages/client-react/package.json | 1 - .../client-react/src/mud/getNetworkConfig.ts | 1 - .../client-react/src/mud/setupNetwork.ts | 17 ---------- .../packages/client-vanilla/package.json | 1 - .../src/mud/getNetworkConfig.ts | 1 - .../client-vanilla/src/mud/setupNetwork.ts | 27 +--------------- examples/minimal/pnpm-lock.yaml | 9 ------ .../packages/client/package.json | 1 - .../client/src/mud/getNetworkConfig.ts | 4 +-- .../packages/client/src/mud/setupNetwork.ts | 31 +------------------ package.json | 4 +-- templates/phaser/packages/client/package.json | 1 - .../react-ecs/packages/client/package.json | 1 - templates/react/packages/client/package.json | 1 - .../threejs/packages/client/package.json | 1 - .../vanilla/packages/client/package.json | 1 - 23 files changed, 7 insertions(+), 156 deletions(-) diff --git a/e2e/packages/client-vanilla/package.json b/e2e/packages/client-vanilla/package.json index d7f2a77d3de..850b4d5c38b 100644 --- a/e2e/packages/client-vanilla/package.json +++ b/e2e/packages/client-vanilla/package.json @@ -15,7 +15,6 @@ "@latticexyz/dev-tools": "link:../../../packages/dev-tools", "@latticexyz/recs": "link:../../../packages/recs", "@latticexyz/schema-type": "link:../../../packages/schema-type", - "@latticexyz/services": "link:../../../packages/services", "@latticexyz/store-sync": "link:../../../packages/store-sync", "@latticexyz/utils": "link:../../../packages/utils", "@latticexyz/world": "link:../../../packages/world", diff --git a/e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts b/e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts index b5f06918e95..67ca3c936ce 100644 --- a/e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts +++ b/e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts @@ -25,7 +25,6 @@ export async function getNetworkConfig() { privateKey: params.get("privateKey") ?? getBurnerPrivateKey(), chainId, chain, - faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl, worldAddress, initialBlockNumber, indexerUrl: params.get("indexerUrl"), diff --git a/e2e/packages/client-vanilla/src/mud/setupNetwork.ts b/e2e/packages/client-vanilla/src/mud/setupNetwork.ts index ea404d43443..f051bcfa6fe 100644 --- a/e2e/packages/client-vanilla/src/mud/setupNetwork.ts +++ b/e2e/packages/client-vanilla/src/mud/setupNetwork.ts @@ -1,5 +1,4 @@ -import { createPublicClient, http, createWalletClient, Hex, parseEther, ClientConfig, stringToHex } from "viem"; -import { createFaucetService } from "@latticexyz/services/faucet"; +import { createPublicClient, http, createWalletClient, Hex, ClientConfig, stringToHex } from "viem"; import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs"; import { getNetworkConfig } from "./getNetworkConfig"; import { world } from "./world"; @@ -52,30 +51,6 @@ export async function setupNetwork() { }), }); - // Request drip from faucet - if (networkConfig.faucetServiceUrl) { - const address = burnerAccount.address; - console.info("[Dev Faucet]: Player address -> ", address); - - const faucet = createFaucetService(networkConfig.faucetServiceUrl); - - const requestDrip = async () => { - const balance = await publicClient.getBalance({ address }); - console.info(`[Dev Faucet]: Player balance -> ${balance}`); - const lowBalance = balance < parseEther("1"); - if (lowBalance) { - console.info("[Dev Faucet]: Balance is low, dripping funds to player"); - // Double drip - await faucet.dripDev({ address }); - await faucet.dripDev({ address }); - } - }; - - requestDrip(); - // Request a drip every 20 seconds - setInterval(requestDrip, 20000); - } - return { world, components, diff --git a/e2e/pnpm-lock.yaml b/e2e/pnpm-lock.yaml index 00648fd18ef..fea9108916c 100644 --- a/e2e/pnpm-lock.yaml +++ b/e2e/pnpm-lock.yaml @@ -29,9 +29,6 @@ importers: '@latticexyz/schema-type': specifier: link:../../../packages/schema-type version: link:../../../packages/schema-type - '@latticexyz/services': - specifier: link:../../../packages/services - version: link:../../../packages/services '@latticexyz/store-sync': specifier: link:../../../packages/store-sync version: link:../../../packages/store-sync diff --git a/examples/minimal/packages/client-phaser/package.json b/examples/minimal/packages/client-phaser/package.json index 58c4e8d3705..15b73113a92 100644 --- a/examples/minimal/packages/client-phaser/package.json +++ b/examples/minimal/packages/client-phaser/package.json @@ -17,7 +17,6 @@ "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/examples/minimal/packages/client-phaser/src/mud/getNetworkConfig.ts b/examples/minimal/packages/client-phaser/src/mud/getNetworkConfig.ts index 47d58804080..e77e5e2e097 100644 --- a/examples/minimal/packages/client-phaser/src/mud/getNetworkConfig.ts +++ b/examples/minimal/packages/client-phaser/src/mud/getNetworkConfig.ts @@ -25,7 +25,6 @@ export async function getNetworkConfig() { privateKey: getBurnerPrivateKey(), chainId, chain, - faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl, worldAddress, initialBlockNumber, }; diff --git a/examples/minimal/packages/client-phaser/src/mud/setupNetwork.ts b/examples/minimal/packages/client-phaser/src/mud/setupNetwork.ts index e8348e953bf..2ee265602de 100644 --- a/examples/minimal/packages/client-phaser/src/mud/setupNetwork.ts +++ b/examples/minimal/packages/client-phaser/src/mud/setupNetwork.ts @@ -1,5 +1,4 @@ -import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, parseEther, ClientConfig } from "viem"; -import { createFaucetService } from "@latticexyz/services/faucet"; +import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, ClientConfig } from "viem"; import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs"; import { getNetworkConfig } from "./getNetworkConfig"; import { world } from "./world"; @@ -43,30 +42,6 @@ export async function setupNetwork() { startBlock: BigInt(networkConfig.initialBlockNumber), }); - // Request drip from faucet - if (networkConfig.faucetServiceUrl) { - const address = burnerAccount.address; - console.info("[Dev Faucet]: Player address -> ", address); - - const faucet = createFaucetService(networkConfig.faucetServiceUrl); - - const requestDrip = async () => { - const balance = await publicClient.getBalance({ address }); - console.info(`[Dev Faucet]: Player balance -> ${balance}`); - const lowBalance = balance < parseEther("1"); - if (lowBalance) { - console.info("[Dev Faucet]: Balance is low, dripping funds to player"); - // Double drip - await faucet.dripDev({ address }); - await faucet.dripDev({ address }); - } - }; - - requestDrip(); - // Request a drip every 20 seconds - setInterval(requestDrip, 20000); - } - return { world, components, diff --git a/examples/minimal/packages/client-react/package.json b/examples/minimal/packages/client-react/package.json index 82db6ad5214..0f931adcd77 100644 --- a/examples/minimal/packages/client-react/package.json +++ b/examples/minimal/packages/client-react/package.json @@ -17,7 +17,6 @@ "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/examples/minimal/packages/client-react/src/mud/getNetworkConfig.ts b/examples/minimal/packages/client-react/src/mud/getNetworkConfig.ts index 47d58804080..e77e5e2e097 100644 --- a/examples/minimal/packages/client-react/src/mud/getNetworkConfig.ts +++ b/examples/minimal/packages/client-react/src/mud/getNetworkConfig.ts @@ -25,7 +25,6 @@ export async function getNetworkConfig() { privateKey: getBurnerPrivateKey(), chainId, chain, - faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl, worldAddress, initialBlockNumber, }; diff --git a/examples/minimal/packages/client-react/src/mud/setupNetwork.ts b/examples/minimal/packages/client-react/src/mud/setupNetwork.ts index c26d4fe250e..9f76938d942 100644 --- a/examples/minimal/packages/client-react/src/mud/setupNetwork.ts +++ b/examples/minimal/packages/client-react/src/mud/setupNetwork.ts @@ -6,7 +6,6 @@ import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json"; import { ContractWrite, createBurnerAccount, getContract, resourceToHex, transportObserver } from "@latticexyz/common"; import { Subject, share } from "rxjs"; import mudConfig from "contracts/mud.config"; -import { createClient as createFaucetClient } from "@latticexyz/faucet"; export type SetupNetworkResult = Awaited>; @@ -56,22 +55,6 @@ export async function setupNetwork() { startBlock: BigInt(networkConfig.initialBlockNumber), } as const); - try { - console.log("creating faucet client"); - const faucet = createFaucetClient({ url: "http://localhost:3002/trpc" }); - - const drip = async () => { - console.log("dripping"); - const tx = await faucet.drip.mutate({ address: burnerAccount.address }); - console.log("got drip", tx); - }; - - drip(); - setInterval(drip, 20_000); - } catch (e) { - console.error(e); - } - return { world, components, diff --git a/examples/minimal/packages/client-vanilla/package.json b/examples/minimal/packages/client-vanilla/package.json index 589c0b538d2..26e3a738213 100644 --- a/examples/minimal/packages/client-vanilla/package.json +++ b/examples/minimal/packages/client-vanilla/package.json @@ -15,7 +15,6 @@ "@latticexyz/dev-tools": "link:../../../../packages/dev-tools", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/examples/minimal/packages/client-vanilla/src/mud/getNetworkConfig.ts b/examples/minimal/packages/client-vanilla/src/mud/getNetworkConfig.ts index 47d58804080..e77e5e2e097 100644 --- a/examples/minimal/packages/client-vanilla/src/mud/getNetworkConfig.ts +++ b/examples/minimal/packages/client-vanilla/src/mud/getNetworkConfig.ts @@ -25,7 +25,6 @@ export async function getNetworkConfig() { privateKey: getBurnerPrivateKey(), chainId, chain, - faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl, worldAddress, initialBlockNumber, }; diff --git a/examples/minimal/packages/client-vanilla/src/mud/setupNetwork.ts b/examples/minimal/packages/client-vanilla/src/mud/setupNetwork.ts index 2260624657f..00939f8380f 100644 --- a/examples/minimal/packages/client-vanilla/src/mud/setupNetwork.ts +++ b/examples/minimal/packages/client-vanilla/src/mud/setupNetwork.ts @@ -1,5 +1,4 @@ -import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, parseEther, ClientConfig } from "viem"; -import { createFaucetService } from "@latticexyz/services/faucet"; +import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, ClientConfig } from "viem"; import { syncToZustand } from "@latticexyz/store-sync/zustand"; import { getNetworkConfig } from "./getNetworkConfig"; import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json"; @@ -41,30 +40,6 @@ export async function setupNetwork() { startBlock: BigInt(networkConfig.initialBlockNumber), }); - // Request drip from faucet - if (networkConfig.faucetServiceUrl) { - const address = burnerAccount.address; - console.info("[Dev Faucet]: Player address -> ", address); - - const faucet = createFaucetService(networkConfig.faucetServiceUrl); - - const requestDrip = async () => { - const balance = await publicClient.getBalance({ address }); - console.info(`[Dev Faucet]: Player balance -> ${balance}`); - const lowBalance = balance < parseEther("1"); - if (lowBalance) { - console.info("[Dev Faucet]: Balance is low, dripping funds to player"); - // Double drip - await faucet.dripDev({ address }); - await faucet.dripDev({ address }); - } - }; - - requestDrip(); - // Request a drip every 20 seconds - setInterval(requestDrip, 20000); - } - return { tables, useStore, diff --git a/examples/minimal/pnpm-lock.yaml b/examples/minimal/pnpm-lock.yaml index 5c4daabaec9..da359483041 100644 --- a/examples/minimal/pnpm-lock.yaml +++ b/examples/minimal/pnpm-lock.yaml @@ -50,9 +50,6 @@ importers: '@latticexyz/schema-type': specifier: link:../../../../packages/schema-type version: link:../../../../packages/schema-type - '@latticexyz/services': - specifier: link:../../../../packages/services - version: link:../../../../packages/services '@latticexyz/store-sync': specifier: link:../../../../packages/store-sync version: link:../../../../packages/store-sync @@ -162,9 +159,6 @@ importers: '@latticexyz/schema-type': specifier: link:../../../../packages/schema-type version: link:../../../../packages/schema-type - '@latticexyz/services': - specifier: link:../../../../packages/services - version: link:../../../../packages/services '@latticexyz/store-sync': specifier: link:../../../../packages/store-sync version: link:../../../../packages/store-sync @@ -250,9 +244,6 @@ importers: '@latticexyz/schema-type': specifier: link:../../../../packages/schema-type version: link:../../../../packages/schema-type - '@latticexyz/services': - specifier: link:../../../../packages/services - version: link:../../../../packages/services '@latticexyz/store-sync': specifier: link:../../../../packages/store-sync version: link:../../../../packages/store-sync diff --git a/examples/multiple-accounts/packages/client/package.json b/examples/multiple-accounts/packages/client/package.json index 66cefb659d1..1117fbe36d3 100644 --- a/examples/multiple-accounts/packages/client/package.json +++ b/examples/multiple-accounts/packages/client/package.json @@ -15,7 +15,6 @@ "@latticexyz/dev-tools": "link:../../../../packages/dev-tools", "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/examples/multiple-accounts/packages/client/src/mud/getNetworkConfig.ts b/examples/multiple-accounts/packages/client/src/mud/getNetworkConfig.ts index 61ad962f252..2794583cca1 100644 --- a/examples/multiple-accounts/packages/client/src/mud/getNetworkConfig.ts +++ b/examples/multiple-accounts/packages/client/src/mud/getNetworkConfig.ts @@ -6,8 +6,7 @@ /* * By default the template just creates a temporary wallet - * (called a burner wallet) and uses a faucet (on our test net) - * to get ETH for it. + * (called a burner wallet). * * See https://mud.dev/tutorials/minimal/deploy#wallet-managed-address * for how to use the user's own address instead. @@ -84,7 +83,6 @@ export async function getNetworkConfig() { privateKey: getBurnerPrivateKey(), chainId, chain, - faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl, worldAddress, initialBlockNumber, }; diff --git a/examples/multiple-accounts/packages/client/src/mud/setupNetwork.ts b/examples/multiple-accounts/packages/client/src/mud/setupNetwork.ts index f401de47022..1b5c6c1b31d 100644 --- a/examples/multiple-accounts/packages/client/src/mud/setupNetwork.ts +++ b/examples/multiple-accounts/packages/client/src/mud/setupNetwork.ts @@ -3,8 +3,7 @@ * (https://viem.sh/docs/getting-started.html). * This line imports the functions we need from it. */ -import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, parseEther, ClientConfig } from "viem"; -import { createFaucetService } from "@latticexyz/services/faucet"; +import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, ClientConfig } from "viem"; import { syncToZustand } from "@latticexyz/store-sync/zustand"; import { getNetworkConfig } from "./getNetworkConfig"; import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json"; @@ -77,34 +76,6 @@ export async function setupNetwork() { startBlock: BigInt(networkConfig.initialBlockNumber), }); - /* - * If there is a faucet, request (test) ETH if you have - * less than 1 ETH. Repeat every 20 seconds to ensure you don't - * run out. - */ - if (networkConfig.faucetServiceUrl) { - const address = burnerAccount.address; - console.info("[Dev Faucet]: Player address -> ", address); - - const faucet = createFaucetService(networkConfig.faucetServiceUrl); - - const requestDrip = async () => { - const balance = await publicClient.getBalance({ address }); - console.info(`[Dev Faucet]: Player balance -> ${balance}`); - const lowBalance = balance < parseEther("1"); - if (lowBalance) { - console.info("[Dev Faucet]: Balance is low, dripping funds to player"); - // Double drip - await faucet.dripDev({ address }); - await faucet.dripDev({ address }); - } - }; - - requestDrip(); - // Request a drip every 20 seconds - setInterval(requestDrip, 20000); - } - return { tables, useStore, diff --git a/package.json b/package.json index bb068ea10a5..4c9ab7bce94 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "release:publish": "pnpm install && pnpm build && changeset publish", "release:version": "changeset version && pnpm install --lockfile-only && pnpm run changelog:generate", "sort-package-json": "npx 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": "pnpm run --recursive --filter=!@latticexyz/services test", - "test:ci": "pnpm run --recursive --parallel --filter=!@latticexyz/services test:ci", + "test": "pnpm run --recursive test", + "test:ci": "pnpm run --recursive --parallel test:ci", "type-stats-repo": "attest stats packages/*" }, "lint-staged": { diff --git a/templates/phaser/packages/client/package.json b/templates/phaser/packages/client/package.json index 285ce6eb377..cc49aeb8225 100644 --- a/templates/phaser/packages/client/package.json +++ b/templates/phaser/packages/client/package.json @@ -17,7 +17,6 @@ "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/templates/react-ecs/packages/client/package.json b/templates/react-ecs/packages/client/package.json index 18098bbb19c..04710c072df 100644 --- a/templates/react-ecs/packages/client/package.json +++ b/templates/react-ecs/packages/client/package.json @@ -16,7 +16,6 @@ "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/templates/react/packages/client/package.json b/templates/react/packages/client/package.json index 66cefb659d1..1117fbe36d3 100644 --- a/templates/react/packages/client/package.json +++ b/templates/react/packages/client/package.json @@ -15,7 +15,6 @@ "@latticexyz/dev-tools": "link:../../../../packages/dev-tools", "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/templates/threejs/packages/client/package.json b/templates/threejs/packages/client/package.json index caaa39d3690..8bf95ab68d8 100644 --- a/templates/threejs/packages/client/package.json +++ b/templates/threejs/packages/client/package.json @@ -16,7 +16,6 @@ "@latticexyz/react": "link:../../../../packages/react", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world", diff --git a/templates/vanilla/packages/client/package.json b/templates/vanilla/packages/client/package.json index 5992b7704ed..58f660b0f54 100644 --- a/templates/vanilla/packages/client/package.json +++ b/templates/vanilla/packages/client/package.json @@ -15,7 +15,6 @@ "@latticexyz/dev-tools": "link:../../../../packages/dev-tools", "@latticexyz/recs": "link:../../../../packages/recs", "@latticexyz/schema-type": "link:../../../../packages/schema-type", - "@latticexyz/services": "link:../../../../packages/services", "@latticexyz/store-sync": "link:../../../../packages/store-sync", "@latticexyz/utils": "link:../../../../packages/utils", "@latticexyz/world": "link:../../../../packages/world",