A class to query all Faucet related queries on Aptos.

Hierarchy (view full)

Faucet

Properties

Faucet

  • Initializes a new instance of the Aptos client with the specified configuration.

    Note that only devnet has a publicly accessible faucet. For testnet, you must use the minting page at https://aptos.dev/network/faucet.

    Parameters

    • config: AptosConfig

      The configuration settings for the Aptos client.

    Returns Faucet

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    async function runExample() {
    // Create a configuration for the Aptos client
    const config = new AptosConfig({ network: Network.DEVNET }); // specify your own network if needed

    // Initialize the Aptos client with the configuration
    const aptos = new Aptos(config);

    console.log("Aptos client initialized:", aptos);
    }
    runExample().catch(console.error);
  • This function creates an account if it does not exist and mints the specified amount of coins into that account.

    Note that only devnet has a publicly accessible faucet. For testnet, you must use the minting page at https://aptos.dev/network/faucet.

    Parameters

    Returns Promise<UserTransactionResponse>

    Transaction hash of the transaction that funded the account.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.DEVNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fund an account with a specified amount of tokens
    const transaction = await aptos.fundAccount({
    accountAddress: "0x1", // replace with your account address
    amount: 100,
    });

    console.log("Transaction hash:", transaction.hash);
    }
    runExample().catch(console.error);

Properties

config: AptosConfig

The configuration settings for the Aptos client.

MMNEPVFCICPMFPCPTTAAATR