Skip to main content

FaucetClient

open class FaucetClient : Disposable, AutoCloseable, FaucetClientInterface

Constructors

FaucetClientconstructor(faucetUrl: String)
Construct a new FaucetClient with the given faucet service URL. This FaucetClient expects that the service provides two endpoints: /v1/gas and /v1/status. As such, do not provide the request endpoint, just the top level service endpoint.

Functions

NameSummary
close@Synchronized
open override fun close()
destroyopen override fun destroy()
requestopen suspend override fun request(address: Address): String?
Request gas from the faucet. Note that this will return the UUID of the request and not wait until the token is received. Use request_and_wait to wait for the token.
requestAndWaitopen suspend override fun requestAndWait(address: Address): FaucetReceipt?
Request gas from the faucet and wait until the request is completed and token is transferred. Returns FaucetReceipt if the request is successful, which contains the list of tokens transferred, and the transaction digest.
requestAndWaitForFinalizedopen suspend override fun requestAndWaitForFinalized(address: Address, client: GraphQlClient): FaucetReceipt?
Request gas from the faucet and wait until the request is completed and token is transferred and finalized on the ledger. Returns FaucetReceipt if the request is successful, which contains the list of tokens transferred, and the transaction digest.
requestStatusopen suspend override fun requestStatus(id: String): BatchSendStatus?
Check the faucet request status.

Companion object functions

NameSummary
newLocalnetfun newLocalnet(): FaucetClient
Create a new Faucet client connected to a localnet faucet.