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"),