@latticexyz/faucet 2.2.2 → 2.2.3-main-1391018e6009c19a6dcd799cc3e6b807696cfe4a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -20
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,30 +1,43 @@
1
- # faucet
2
-
3
1
  A minimal Typescript faucet to drip native tokens on Ethereum chains
4
2
 
5
3
  ## Usage
6
4
 
7
- Install and run with:
5
+ 1. Specify the environment variables.
6
+ Note that you need to [`export`](https://linuxconfig.org/export) these variables for the faucet service to get them.
8
7
 
9
- ```sh
10
- npm install @latticexyz/faucet@next
11
- npm faucet-server
12
- ```
8
+ | Variable | Description | Default |
9
+ | -------------------------- | ----------------------------------------------------- | --------- |
10
+ | `HOST` | Host that the indexer server listens on | `0.0.0.0` |
11
+ | `PORT` | Port that the indexer server listens on | `3002` |
12
+ | `RPC_HTTP_URL`<sup>1</sup> | HTTP URL for Ethereum RPC | |
13
+ | `FAUCET_PRIVATE_KEY` | Private key of wallet to distribute faucet funds from | |
14
+ | `DRIP_AMOUNT_ETHER` | Drip amount in ether | |
13
15
 
14
- or execute the package bin directly:
16
+ (1) If you use `http://localhost:8545` and it fails try using `http://127.0.0.1:8545` instead
15
17
 
16
- ```sh
17
- npx @latticexyz/faucet@next
18
- ```
18
+ 1. Start the server.
19
+
20
+ ```sh copy
21
+ npx @latticexyz/faucet
22
+ ```
19
23
 
20
- ## Configuration
24
+ For example, you can use these values to drip 1 ETH for a local [`anvil`](https://book.getfoundry.sh/anvil/) instance:
21
25
 
22
- The faucet can configured with the following environment variables:
26
+ | Variable | Value | Comments |
27
+ | -------------------- | ------------------------------------------------------------------ | ---------------------------------- |
28
+ | `RPC_HTTP_URL` | http://127.0.0.1:8545 | `localhost` sometimes doesn't work |
29
+ | `FAUCET_PRIVATE_KEY` | 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d | One of the default accounts |
30
+ | `DRIP_AMOUNT_ETHER` | 1 |
23
31
 
24
- | Variable | Description | Default |
25
- | -------------------- | ----------------------------------------------------- | --------- |
26
- | `HOST` | Host that the indexer server listens on | `0.0.0.0` |
27
- | `PORT` | Port that the indexer server listens on | `3002` |
28
- | `RPC_HTTP_URL` | HTTP URL for Ethereum RPC | |
29
- | `FAUCET_PRIVATE_KEY` | Private key of wallet to distribute faucet funds from | |
30
- | `DRIP_AMOUNT_ETHER` | Drip amount in ether |
32
+ ## Getting ETH from a faucet
33
+
34
+ [This sample program](https://github.com/latticexyz/mud/tree/main/examples/faucet-client) shows how to obtain ETH from a faucet using TypeScript.
35
+
36
+ Alternatively, you can submit a `POST` request to the faucet.
37
+ For example, if you use the default `HOST` and `PORT`, this command requests a drip to the zero address.
38
+
39
+ ```sh copy
40
+ curl -X POST http://127.0.0.1:3002/trpc/drip \
41
+ -H "Content-Type: application/json" \
42
+ -d '{"address": "0x0000000000000000000000000000000000000000"}'
43
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/faucet",
3
- "version": "2.2.2",
3
+ "version": "2.2.3-main-1391018e6009c19a6dcd799cc3e6b807696cfe4a",
4
4
  "description": "Faucet API for Lattice testnet",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "fastify": "^4.21.0",
36
36
  "viem": "2.19.8",
37
37
  "zod": "3.23.8",
38
- "@latticexyz/common": "2.2.2"
38
+ "@latticexyz/common": "2.2.3-main-1391018e6009c19a6dcd799cc3e6b807696cfe4a"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/debug": "^4.1.7",