Skip to main content

requestIotaFromFaucet

@iota/iota-sdk


@iota/iota-sdk / faucet / requestIotaFromFaucet

Function: requestIotaFromFaucet()

requestIotaFromFaucet(input): Promise<number | undefined>

Defined in: sdk/typescript/src/faucet/faucet.ts:143

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

Parameters​

input​

delayMs?​

number

Milliseconds to wait between poll attempts (default: 1500).

headers?​

HeadersInit

Optional HTTP headers forwarded to every faucet call.

host​

string

Base URL of the faucet service.

maxAttempts?​

number

Maximum number of status-poll attempts before giving up (default: 20).

recipient​

string

Address to receive the tokens.

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.