Skip to content

Commit

Permalink
docs: remove references to faucet in setupNetwork.ts 🏎 (#2829)
Browse files Browse the repository at this point in the history
  • Loading branch information
qbzzt authored May 15, 2024
1 parent 2b84bb5 commit d3c548b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 90 deletions.
31 changes: 1 addition & 30 deletions docs/pages/guides/extending-a-world/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ We will now fix this.
<CollapseCode>
```ts filename="setupNetwork.ts" copy showLineNumbers {26-27,40,97}
```ts filename="setupNetwork.ts" copy showLineNumbers {25-26,39,96}
/*
* The MUD client code is built on top of viem
* (https://viem.sh/docs/getting-started.html).
Expand All @@ -715,7 +715,6 @@ We will now fix this.
ClientConfig,
getContract,
} from "viem";
import { createFaucetService } from "@latticexyz/services/faucet";
import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";

import { getNetworkConfig } from "./getNetworkConfig";
Expand Down Expand Up @@ -799,34 +798,6 @@ We will now fix this.
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 {
world,
components,
Expand Down
31 changes: 1 addition & 30 deletions docs/pages/guides/hello-world/filter-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Edit `packages/client/src/mud/setupNetwork.ts`.

<CollapseCode>

```ts filename="setupNetwork.ts" copy showLineNumbers {25-26,96-108}
```ts filename="setupNetwork.ts" copy showLineNumbers {24-25,95-107}
/*
* The MUD client code is built on top of viem
* (https://viem.sh/docs/getting-started.html).
Expand All @@ -39,7 +39,6 @@ import {
ClientConfig,
getContract,
} from "viem";
import { createFaucetService } from "@latticexyz/services/faucet";
import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";

import { getNetworkConfig } from "./getNetworkConfig";
Expand Down Expand Up @@ -133,34 +132,6 @@ export async function setupNetwork() {
],
});

/*
* 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 {
world,
components,
Expand Down
31 changes: 1 addition & 30 deletions docs/pages/state-query/typescript/zustand.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ To read data you use `useStore.getState()`. It supports the same functions as th

<CollapseCode>

```ts filename="setupNetwork.ts" showLineNumbers copy {14,86-93,124-125}
```ts filename="setupNetwork.ts" showLineNumbers copy {22,94-103,106-107}
/*
* The MUD client code is built on top of viem
* (https://viem.sh/docs/getting-started.html).
Expand All @@ -242,7 +242,6 @@ To read data you use `useStore.getState()`. It supports the same functions as th
parseEther,
ClientConfig,
} from "viem";
import { createFaucetService } from "@latticexyz/services/faucet";
import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";

import { getNetworkConfig } from "./getNetworkConfig";
Expand Down Expand Up @@ -332,34 +331,6 @@ To read data you use `useStore.getState()`. It supports the same functions as th
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

0 comments on commit d3c548b

Please sign in to comment.