Skip to main content

Class: FaucetClient

Extends​

  • UniffiAbstractObject

Implements​

Constructors​

Constructor​

new FaucetClient(faucetUrl): FaucetClient;

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.

  • /v1/gas is used to request gas
  • /v1/status/task-uuid is used to check the status of the request

Parameters​

faucetUrl​

string

Returns​

FaucetClient

Overrides​

UniffiAbstractObject.constructor

Properties​

[destructorGuardSymbol]​

readonly [destructorGuardSymbol]: UniffiGcObject;

[pointerLiteralSymbol]​

readonly [pointerLiteralSymbol]: bigint;

[uniffiTypeNameSymbol]​

readonly [uniffiTypeNameSymbol]: "FaucetClient" = "FaucetClient";

Methods​

request()​

request(address, asyncOpts_?): Promise<string | undefined>;

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.

Parameters​

address​

AddressLike

asyncOpts_?​
signal​

AbortSignal

Returns​

Promise<string | undefined>

Implementation of​

FaucetClientLike.request


requestAndWait()​

requestAndWait(address, asyncOpts_?): Promise<FaucetReceipt | undefined>;

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.

Note that the faucet is heavily rate-limited, so calling repeatedly the faucet would likely result in a 429 code or 502 code.

If you intend to use the transferred tokens with the graphql client, consider using request_and_wait_for_finalized instead to ensure the tokens are available in the indexer.

Parameters​

address​

AddressLike

asyncOpts_?​
signal​

AbortSignal

Returns​

Promise<FaucetReceipt | undefined>

Implementation of​

FaucetClientLike.requestAndWait


requestAndWaitForFinalized()​

requestAndWaitForFinalized(
address,
client,
asyncOpts_?
): Promise<FaucetReceipt | undefined>;

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.

This is a convenience method that combines request_and_wait and waiting for the funding transactions to be finalized using the provided GraphQL Client.

Parameters​

address​

AddressLike

client​

GraphQlClientLike

asyncOpts_?​
signal​

AbortSignal

Returns​

Promise<FaucetReceipt | undefined>

Implementation of​

FaucetClientLike.requestAndWaitForFinalized


requestStatus()​

requestStatus(id, asyncOpts_?): Promise<BatchSendStatus | undefined>;

Check the faucet request status.

Possible statuses are defined in: BatchSendStatusType

Parameters​

id​

string

asyncOpts_?​
signal​

AbortSignal

Returns​

Promise<BatchSendStatus | undefined>

Implementation of​

FaucetClientLike.requestStatus


uniffiDestroy()​

uniffiDestroy(): void;

Explicitly tell Rust to destroy the native peer that backs this object.

Once this method has been called, any following method calls will throw an error.

Can be called more than once.

Returns​

void

Overrides​

UniffiAbstractObject.uniffiDestroy

uniffiUse()​

uniffiUse<T>(block): T;

A convenience method to use this object, then destroy it after its use.

Type Parameters​

T​

T

Parameters​

block​

(obj) => T

Returns​

T

Inherited from​

UniffiAbstractObject.uniffiUse

instanceOf()​

static instanceOf(obj_): obj_ is FaucetClient;

Parameters​

obj_​

any

Returns​

obj_ is FaucetClient


newLocalnet()​

static newLocalnet(): FaucetClientLike;

Create a new Faucet client connected to a localnet faucet.

Returns​

FaucetClientLike