aftermath-ts-sdk - v3.3.3
    Preparing search index...

    Prepares a transaction through the Aftermath dynamic-gas HTTP service.

    The service receives the serialized transaction, wallet address, and preferred coin type at the configured dynamic-gas endpoint. This class does not use the Sui gRPC or JSON-RPC clients.

    Hierarchy (View Summary)

    Index
    config: CallerConfig

    The mutable configuration used for subsequent requests.

    • Sends a transaction to the dynamic-gas service for gas preparation.

      This method performs one HTTP POST request to /api/dynamic-gas under the configured base URL. It serializes tx with Transaction.toJSON() and sends the wallet address and preferred Move coin type in the JSON body. It does not sign or execute the transaction locally.

      Parameters

      • inputs: { gasCoinType: string; tx: Transaction; walletAddress: string }

        The transaction to serialize, the Sui wallet address, and a fully qualified coin type such as 0x2::sui::SUI.

      Returns Promise<ApiDynamicGasResponse>

      The service's serialized transaction bytes and sponsor signature.

      AftermathTransportError for HTTP, network, abort, timeout, or response-decode failures. A missing API base URL also rejects the request.

      import { Aftermath } from "aftermath-ts-sdk";
      import { Transaction } from "@mysten/sui/transactions";

      const afSdk = await Aftermath.create({ network: "MAINNET" });
      const dynamicGas = afSdk.DynamicGas();
      const transactionBlock = new Transaction();

      const updatedTx = await dynamicGas.getUseDynamicGasForTx({
      tx: transactionBlock,
      walletAddress: "0x00000000000000000000000000000000000000000000000000000000000000aa",
      gasCoinType: "0x2::sui::SUI"
      });
      // Use updatedTx.txBytes and updatedTx.sponsoredSignature in the signing flow.
    • Returns the canonical Aftermath API host for a Sui network.

      To target a custom or local host, pass baseUrl in CallerConfig to the constructor instead.

      Parameters

      • network: SuiNetwork

        The Sui network whose host to return.

      Returns string

      The network's HTTPS or local HTTP API host.