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

    The Aftermath class is the primary entry point for interacting with the Aftermath Finance protocols and utilities on the Sui blockchain. It exposes sub-providers (e.g. Router, Staking, Farms) configured for the chosen network.

    Instances are created through the async Aftermath.create factory — direct construction is not supported. Package accessors return a new provider on each call. Providers that need package or object addresses throw when their section is missing from the configured ConfigAddresses.

    import { Aftermath } from "aftermath-ts-sdk";

    const aftermath = await Aftermath.create({ network: "MAINNET" });
    const supportedCoins = await aftermath.Router().getSupportedCoins();

    Hierarchy (View Summary)

    Index
    config: CallerConfig

    The mutable configuration used for subsequent requests.

    casting: typeof Casting = Casting

    Static casting utilities for conversions such as bigint and IFixed.

    helpers: typeof Helpers = Helpers

    Reusable static helpers for parsing, validation, math, and transaction utilities.

    • Returns a Coin helper for the given coin type. Pass undefined for generic coin-metadata utilities.

      Parameters

      • OptionalcoinType: string

        Optional fully qualified Move coin type, such as "0x2::sui::SUI".

      Returns Coin

      A new Coin provider for the requested type or for generic coin metadata.

    • Fetches the Aftermath on-chain addresses (object IDs, packages, etc.) directly from the API. Typically you don't need to call this — the create factory handles it. Useful for cache warmers or tooling.

      Parameters

      • OptionalabortSignal: AbortSignal

        Optional signal that cancels the HTTP request.

      Returns Promise<ConfigAddresses>

      A promise for the package and object addresses returned by the API.

      A transport error when the request fails, the response cannot be decoded, or the signal aborts it.

    • Returns the resolved Aftermath API base URL for this instance.

      The value is the configured baseUrl, or the canonical URL selected from network when no override was supplied.

      Returns string | undefined

      The API base URL, or undefined when the inherited caller has no endpoint.

    • Attempts to decode a raw Move abort/error string into a structured error code, package ID, module name, and human-readable message. Returns undefined when no registered package recognizes the error.

      Thin pass-through to the underlying AftermathApi so consumers don't need to reach into the private api field.

      Parameters

      • inputs: { errorMessage: string }
        • errorMessage: string

          Raw Sui Move-abort text to parse and translate.

      Returns TranslatedMoveError | undefined

      The parsed error and registered message, or undefined when the text is malformed or unregistered.

    • Creates a Wallet instance scoped to a specific user address.

      Parameters

      • address: string

        The Sui address (e.g., "0x...").

      Returns Wallet

      A new Wallet provider scoped to address.

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

    • Constructs and fully initializes an Aftermath instance.

      Resolves on-chain addresses, configures the Sui fullnode client, and returns a ready-to-use instance. Pass addresses or api to skip the corresponding bootstrap steps. The selected network supplies canonical API and fullnode URLs unless the options provide overrides.

      Parameters

      • options: AftermathOptions = {}

        Network, endpoint, address, and low-level API options.

      • OptionalabortSignal: AbortSignal

        Optional signal that cancels address discovery.

      Returns Promise<Aftermath>

      A fully initialized provider.

      A transport error if address discovery fails or the signal aborts it.

      const aftermath = await Aftermath.create({ network: "TESTNET" });