Creates a dynamic-gas service client.
Optionalconfig: CallerConfig
Optional caller configuration. Set network to use the
canonical Aftermath host, or set baseUrl for a custom or local service.
Include accessToken when the service requires authentication.
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.
The transaction to serialize, the Sui wallet address, and a
fully qualified coin type such as 0x2::sui::SUI.
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.
StaticapiReturns the canonical Aftermath API host for a Sui network.
To target a custom or local host, pass baseUrl in CallerConfig to the
constructor instead.
The Sui network whose host to return.
The network's HTTPS or local HTTP API host.
StaticdefaultReturns the canonical Sui fullnode URL for a network.
The network whose fullnode URL to return. undefined
defaults to mainnet.
The network's fullnode URL.
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-gasendpoint. This class does not use the Sui gRPC or JSON-RPC clients.