Skip to content

Commit

Permalink
remove more usages
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed May 14, 2024
1 parent 73e7ad8 commit 6202194
Show file tree
Hide file tree
Showing 23 changed files with 7 additions and 156 deletions.
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
1 change: 0 additions & 1 deletion templates/phaser/packages/client/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
1 change: 0 additions & 1 deletion templates/react-ecs/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion templates/react/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
1 change: 0 additions & 1 deletion templates/threejs/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion templates/vanilla/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/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

0 comments on commit 6202194

Please sign in to comment.