FaucetClient
Midnight.js API Reference v2.0.2
Midnight.js API Reference / @midnight-ntwrk/midnight-js-testing / FaucetClient
Class: FaucetClient
Client for interacting with the Midnight faucet service. Provides functionality to request test tokens for wallet addresses.
Constructorsβ
Constructorβ
new FaucetClient(
faucetUrl,logger):FaucetClient
Creates a new FaucetClient instance.
Parametersβ
faucetUrlβ
string
The URL of the faucet service endpoint
loggerβ
Logger
Logger instance for recording operations
Returnsβ
FaucetClient
Propertiesβ
faucetUrlβ
readonlyfaucetUrl:string
Methodsβ
health()β
health():
Promise<void|AxiosResponse<any,any>>
Checks the health status of the faucet service. Makes a GET request to the health endpoint of the faucet service.
Returnsβ
Promise<void | AxiosResponse<any, any>>
A promise that resolves to the response of the health check or logs an error if the request fails
requestTokens()β
requestTokens(
walletAddress):Promise<void>
Requests test tokens from the faucet for a specified wallet address. Makes a POST request to the faucet service with the wallet address.
Parametersβ
walletAddressβ
string
The address to receive the test tokens
Returnsβ
Promise<void>
A promise that resolves when the request is complete
Throwsβ
Will log but not throw if the request fails