> ## Documentation Index
> Fetch the complete documentation index at: https://cosmos-docs-cosmjs-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# @cosmjs/faucet-client

> HTTP client for the CosmJS token faucet

Simple HTTP client for requesting tokens from a `@cosmjs/faucet` server. Useful for testnet development.

```bash theme={"system"}
npm install @cosmjs/faucet-client
```

## FaucetClient

| Method        | Parameters                         | Returns         |
| ------------- | ---------------------------------- | --------------- |
| `constructor` | `baseUrl: string`                  | `FaucetClient`  |
| `credit`      | `address: string`, `denom: string` | `Promise<void>` |

### Usage

```typescript theme={"system"}
import { FaucetClient } from "@cosmjs/faucet-client";

const faucet = new FaucetClient("http://localhost:8000");

await faucet.credit("cosmos1youraddress...", "uatom");
```

The `credit` method sends a POST to `{baseUrl}/credit`. It will throw on network errors (e.g. unreachable host) but does not inspect the HTTP response status code for faucet-level errors such as cooldowns or insufficient funds.
