Creates a transaction helper for a configured AftermathApi.
The API instance used by history queries and gas estimation.
Builds the transaction kind and encodes its bytes as base64.
This helper performs no direct network request. It asks the Sui transaction
builder for onlyTransactionKind: true, using the configured gRPC client
as the builder client when input resolution requires it. An absent
transaction is treated as no work and returns undefined.
The transaction to build, or undefined.
Base64 transaction-kind bytes, or undefined when tx is absent.
Serializes a transaction, estimating gas unless it is already sponsored.
A sponsored transaction is serialized locally with toJSON() and does not
call the gRPC client. An unsponsored transaction performs the same gRPC gas
simulation and reference-price lookup as fetchSetGasBudgetForTx before
serialization. The input may be an existing transaction or a promise for
one.
The transaction or transaction promise and the sponsorship
flag. Set isSponsoredTx to true only when gas has already been supplied
by the sponsor.
The serialized transaction string produced by toJSON().
Estimates gas with gRPC simulation and applies a safe budget and reference gas price to a transaction.
This method performs two gRPC requests: it simulates the built transaction
and reads the current reference gas price. The budget is the simulation's
computation cost plus storage cost, increased by 10% with integer division.
Storage rebate and non-refundable storage fee are not included. The method
sets both values as bigint on the original transaction and returns that
same transaction object. Failed simulations can still provide effects and
are used for the gas estimate.
The transaction to build and update. The transaction must
contain enough information for tx.build to resolve its inputs.
The same transaction after setGasBudget and setGasPrice run.
Fetches one page of transaction history and returns the next digest cursor.
This method performs network I/O through the optional JSON-RPC client. It
requests input, effects, events, balance changes, and object changes for
every returned transaction. The gRPC client has no equivalent for this
query, so callers must configure AftermathApi.jsonRpcClient.
The JSON-RPC transaction query, optional transaction digest cursor, and page limit. The cursor is the last digest from the previous page.
The transaction responses and nextCursor. nextCursor is
null when no later page is available.
Remaining JSON-RPC surface. suix_queryTransactionBlocks has
no gRPC equivalent — Sui's own migration cookbook directs callers to
GraphQL or an indexer — so this helper still goes through
AftermathApi.jsonRpcClient and will stop working when JSON-RPC is
removed from fullnodes (scheduled for mid-October 2026). Prefer the
Aftermath API's transaction-history endpoints.
If no jsonRpcClient was passed to AftermathApi, since it
is optional there.
StaticcoinConverts service coin data back to a Sui transaction object argument.
This is a local conversion and performs no network I/O. Input, Result,
and NestedResult forms are supported. The { Coin: ObjectId } form is
intentionally unsupported by this converter and throws an error.
The service coin-data value to convert.
A Sui transaction object argument.
StaticcoinConverts legacy V2 service coin data back to a Sui transaction argument.
This is a local conversion and performs no network I/O. "Gas" becomes
{ GasCoin: true }; indexed input, result, and nested-result forms keep
their numeric indices. The value type must match its key.
The legacy service coin-data value to convert.
A Sui transaction object argument.
StaticcreateCreates a transaction-builder function with a fixed sender input.
This factory performs no network I/O. Each returned function creates a new
Transaction, sets its sender to walletAddress, and invokes func with
the new transaction plus the remaining inputs. func must add commands to
inputs.tx; its returned TransactionArgument is ignored.
The callback that receives the new transaction and inputs.
A function that builds a new transaction with the supplied sender.
import { AftermathApi } from "aftermath-ts-sdk";
import type { Transaction } from "@mysten/sui/transactions";
const build = AftermathApi.helpers.transactions.createBuildTxFunc(
(inputs: { tx: Transaction; walletAddress: string; amount: bigint }) => {
const amount = inputs.tx.pure.u64(inputs.amount);
inputs.tx.moveCall({
target: "0x2::example::use_amount",
arguments: [amount],
});
return amount;
}
);
const tx = build({
walletAddress: "0x0000000000000000000000000000000000000000000000000000000000000001",
amount: 10n,
});
StaticcreateBuilds a fully qualified Move call target.
This is a local string operation and performs no network I/O. It does not validate the address, module, or function segments.
The published package address.
The Move module name.
The Move function name.
A string in the form packageAddress::packageName::functionName.
StaticserviceConverts a Sui coin transaction argument to the service coin-data shape.
This is a local conversion and performs no network I/O. Object or type
strings are normalized with 64-hex-digit leading zeroes. Input, result,
and nested-result arguments keep their indices. Gas coin arguments cannot
be represented by ServiceCoinData and throw instead.
The object ID or transaction argument to convert.
A ServiceCoinData object with Coin, Input, Result, or
NestedResult.
StaticserviceConverts a Sui coin transaction argument to the legacy V2 service shape.
This is a local conversion and performs no network I/O. Input, result, and
nested-result indices are preserved. A gas coin is represented by the
string "Gas"; this V2 shape does not accept an object ID string.
The transaction argument to convert.
"Gas", or an Input, Result, or NestedResult object.
StaticsplitAdds a Sui coin-split Move call to a transaction.
This is a local transaction builder and performs no network I/O. It adds
0x2::coin::split<CoinType> to tx, using coinId as the source coin and
amount as a u64 in the coin's smallest on-chain unit. The transaction is
mutated in place and still needs gas, signing, and execution by the caller.
The transaction, coin Move type, source coin object ID, and amount in the coin's smallest unit.
The transaction argument returned by moveCall.
StatictransferCopies sender, expiration, and gas metadata from one transaction to another.
This is a local transaction operation and performs no network I/O. It
copies sender, expiration, gasData.owner, gasData.payment, and gas
values when they are bigint. String gas budget and price values are
skipped because the transaction setters require numeric values here. Fields
absent from initTx are not cleared from newTx.
The source transaction and the transaction to update.
Nothing. newTx is mutated in place.
Queries transaction history and builds or converts Sui transaction data.
Transaction history still uses the optional JSON-RPC client. Gas estimation uses the configured gRPC client and reference gas price. Static conversion and transaction-builder methods run locally and do not perform network I/O.