Skip to content

Commit

Permalink
chore: remove cli faucet command and services package (#2811)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed May 14, 2024
1 parent 27f888c commit 4a61a12
Show file tree
Hide file tree
Showing 53 changed files with 22 additions and 2,481 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-turtles-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/cli": patch
---

Removed broken `mud faucet` command.
5 changes: 5 additions & 0 deletions .changeset/sixty-frogs-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-mud": patch
---

Removed usages of old testnet faucet in templates. The previous testnet faucet is broken, deprecated, and going offline soon. We'll be replacing the burner account pattern with something better very soon!
1 change: 0 additions & 1 deletion docs/pages/cli/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export default {
verify: "mud verify",
"dev-contracts": "mud dev-contracts",
"abi-ts": "mud abi-ts",
faucet: "mud faucet",
"set-version": "mud set-version",
};
5 changes: 0 additions & 5 deletions docs/pages/cli/faucet.mdx

This file was deleted.

1 change: 0 additions & 1 deletion e2e/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion e2e/packages/client-vanilla/src/mud/getNetworkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
27 changes: 1 addition & 26 deletions e2e/packages/client-vanilla/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/minimal/packages/client-phaser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export async function getNetworkConfig() {
privateKey: getBurnerPrivateKey(),
chainId,
chain,
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
};
Expand Down
27 changes: 1 addition & 26 deletions examples/minimal/packages/client-phaser/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export async function getNetworkConfig() {
privateKey: getBurnerPrivateKey(),
chainId,
chain,
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
};
Expand Down
17 changes: 0 additions & 17 deletions examples/minimal/packages/client-react/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof setupNetwork>>;

Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion examples/minimal/packages/client-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export async function getNetworkConfig() {
privateKey: getBurnerPrivateKey(),
chainId,
chain,
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
};
Expand Down
27 changes: 1 addition & 26 deletions examples/minimal/packages/client-vanilla/src/mud/setupNetwork.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 0 additions & 9 deletions examples/minimal/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/multiple-accounts/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function getNetworkConfig() {
privateKey: getBurnerPrivateKey(),
chainId,
chain,
faucetServiceUrl: params.get("faucet") ?? chain.faucetUrl,
worldAddress,
initialBlockNumber,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@
"@aws-sdk/client-kms": "^3.556.0",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@improbable-eng/grpc-web": "^0.15.0",
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
"@latticexyz/abi-ts": "workspace:*",
"@latticexyz/common": "workspace:*",
"@latticexyz/config": "workspace:*",
"@latticexyz/gas-report": "workspace:*",
"@latticexyz/protocol-parser": "workspace:*",
"@latticexyz/schema-type": "workspace:*",
"@latticexyz/services": "workspace:*",
"@latticexyz/store": "workspace:*",
"@latticexyz/utils": "workspace:*",
"@latticexyz/world": "workspace:*",
Expand All @@ -55,7 +52,6 @@
"ethers": "^5.7.2",
"execa": "^7.0.0",
"glob": "^8.0.3",
"nice-grpc-web": "^2.0.1",
"openurl": "^1.1.1",
"p-queue": "^7.4.1",
"p-retry": "^5.1.2",
Expand Down

0 comments on commit 4a61a12

Please sign in to comment.