Skip to main content

Function: requestIotaFromFaucet()

function requestIotaFromFaucet(input): Promise<number | undefined>;

Submits a V1 faucet request for the given recipient and polls until the request succeeds, is discarded, or the attempt limit is reached.

Parameters

ParameterTypeDescription
input{ host: string; recipient: string; headers?: HeadersInit; maxAttempts?: number; delayMs?: number; }-
input.hoststringBase URL of the faucet service.
input.recipientstringAddress to receive the tokens.
input.headers?HeadersInitOptional HTTP headers forwarded to every faucet call.
input.maxAttempts?numberMaximum number of status-poll attempts before giving up (default: 20).
input.delayMs?numberMilliseconds to wait between poll attempts (default: 1500).

Returns

Promise<number | undefined>

The total amount of gas transferred, or undefined if the faucet response contained no coin info.

Throws

When the request is discarded, the attempt limit is exceeded, or the faucet returns an error at any stage.