A class to handle all Coin operations.

Hierarchy (view full)

Coin

  • Initializes a new instance of the Aptos client with the specified configuration. This allows you to interact with the Aptos blockchain using the provided settings.

    Parameters

    • config: AptosConfig

      The configuration settings for the Aptos client.

    Returns Coin

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

    async function runExample() {
    // Create a new Aptos client with testnet configuration
    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    console.log("Aptos client initialized:", aptos);
    }
    runExample().catch(console.error);
  • Generate a transfer coin transaction that can be simulated, signed, and submitted. This function helps you create a transaction to transfer a specified amount of coins from one account to another within the Aptos network.

    Parameters

    Returns Promise<SimpleTransaction>

    SimpleTransaction

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

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

    async function runExample() {
    // Generate a transfer coin transaction
    const transaction = await aptos.transferCoinTransaction({
    sender: "0x1", // replace with a real sender account address
    recipient: "0x2", // replace with a real recipient account address
    amount: 10,
    });

    console.log(transaction);
    }
    runExample().catch(console.error);

Properties

config: AptosConfig

The configuration settings for the Aptos client.

MMNEPVFCICPMFPCPTTAAATR