@aptos-labs/ts-sdk - v5.1.4
    Preparing search index...

    Class Build

    A class to handle all Build transaction operations.

    Index

    Implementation

    Properties

    Implementation

    • 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 Build

      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.TESTNET, // specify the network
      nodeUrl: "https://testnet.aptos.dev", // specify the node URL
      });

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

      console.log("Aptos client initialized:", aptos);
      }
      runExample().catch(console.error);
    • Build a multi-agent transaction that allows multiple signers to authorize a transaction.

      Parameters

      Returns Promise<MultiAgentTransaction>

      MultiAgentTransaction

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

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

      async function runExample() {
      // Build a multi-agent transaction
      const transaction = await aptos.multiAgent({
      sender: "0x1", // replace with a real sender account address
      data: {
      // Transaction data structure
      function: "0x1::aptos_account::transfer",
      functionArguments: ["0x2", 100], // replace with a real destination account address and amount
      },
      secondarySignerAddresses: ["0x3", "0x4"], // replace with real secondary signer addresses
      options: {
      // Optional transaction configurations
      maxGasAmount: "1000",
      gasUnitPrice: "1",
      },
      });

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

    Properties

    config: AptosConfig