Skip to main content
Simple HTTP client for requesting tokens from a @cosmjs/faucet server. Useful for testnet development.
npm install @cosmjs/faucet-client

FaucetClient

MethodParametersReturns
constructorbaseUrl: stringFaucetClient
creditaddress: string, denom: stringPromise<void>

Usage

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.