Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(faucet): add readme #1534

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twelve-monkeys-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/faucet": patch
---

Added README
30 changes: 30 additions & 0 deletions packages/faucet/README.md
Original file line number Diff line number Diff line change
@@ -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 |
4 changes: 1 addition & 3 deletions packages/faucet/bin/faucet-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down