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

    Provides high-level SuiFrens reads, event queries, fee calculations, and unsigned transaction builders.

    Read and event methods use the configured Aftermath API host. Transaction methods require the optional AftermathApi provider and return unsigned Transaction objects for the caller's wallet to sign and execute.

    Hierarchy (View Summary)

    Index

    Optional AftermathApi required by transaction builders.

    config: CallerConfig

    The mutable configuration used for subsequent requests.

    constants: {
        mixingFeeCoinType: string;
        protocolFees: {
            minMixStaked: bigint;
            mint: bigint;
            mixOwned: bigint;
            mixStakedPercentage: number;
        };
        suifrenFees: { mint: bigint };
    } = ...

    Fixed SuiFrens coin, protocol-fee, and mint-fee values. Balances are in MIST.

    Type Declaration

    • mixingFeeCoinType: string

      Coin type used to pay SuiFrens mixing fees.

    • protocolFees: {
          minMixStaked: bigint;
          mint: bigint;
          mixOwned: bigint;
          mixStakedPercentage: number;
      }

      Protocol fees and the staked-parent fee percentage.

      • minMixStaked: bigint

        Minimum extra fee per staked parent: 0.25 SUI, or 250_000_000 MIST.

      • mint: bigint

        Mint protocol fee: 0.25 SUI, or 250_000_000 MIST.

      • mixOwned: bigint

        Mix fee when both parents are owned: 0.25 SUI, or 250_000_000 MIST.

      • mixStakedPercentage: number

        Fraction of a staked parent's mixFee added to the internal fee.

    • suifrenFees: { mint: bigint }

      SuiFren-specific fee values.

      • mint: bigint

        SuiFren mint fee: 8 SUI, or 8_000_000_000 MIST.

    • Builds an unsigned transaction that harvests fees from staked positions.

      The returned transaction sets walletAddress as sender and transfers the harvested coin to that address after processing every position.

      Parameters

      Returns Promise<Transaction>

      An unsigned Sui Transaction.

      Error when no AftermathApi is available or the list is empty.

    • Builds an unsigned mix transaction for two SuiFrens.

      The low-level builder selects the Move branch from the two optional parent mixFee values, adds baseFee to the calculated internal fee, selects the required SUI coin, and sets walletAddress as sender. The caller must sign and execute the returned transaction.

      Parameters

      • inputs: ApiMixSuiFrensBody

        Parent IDs and optional staked fees, base fee, SuiFren type, wallet, and sponsorship flag.

      Returns Promise<Transaction>

      An unsigned Sui Transaction.

      Error when no AftermathApi is available.

      Errors from coin selection, the provider, or the Sui transaction builder.

    • Fetches staked SuiFrens by their metadata object IDs.

      Parameters

      • inputs: { stakedSuiFrenIds: string[] }

        Staked SuiFren metadata object IDs.

      Returns Promise<StakedSuiFren[]>

      Staked wrappers without owned-position data.

      AftermathTransportError when the request or response fails.

    • Fetches aggregate SuiFrens statistics.

      The response includes vault totals and mix-event totals calculated over the previous 24 hours.

      Returns Promise<SuiFrenStats>

      Current totals, 24-hour fee volume, and 24-hour mix count.

      AftermathTransportError when the stats request fails.

    • Fetches one SuiFren by object ID.

      Parameters

      • inputs: { suiFrenObjectId: string }

        The SuiFren object ID.

      Returns Promise<SuiFren>

      The first matching SuiFren wrapper, or undefined when the API returns no object.

      AftermathTransportError when the request or response fails.

    • Fetches SuiFrens by object IDs and wraps the results as non-owned objects.

      Parameters

      • inputs: { suiFrenObjectIds: string[] }

        On-chain SuiFren object IDs.

      Returns Promise<SuiFren[]>

      The returned SuiFren wrappers in API response order.

      AftermathTransportError when the request or response fails.

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

    • Calculates the internal mix fee for two parent SuiFrens.

      An undefined parent fee represents an owned, non-staked parent. When both fees are undefined, the method returns the fixed mixOwned fee. For each defined staked fee, it adds the greater of minMixStaked and 10% of that fee. The result excludes baseFee from ApiMixSuiFrensBody.

      Parameters

      • inputs: { mixFee1: bigint | undefined; mixFee2: bigint | undefined }

        Optional staked-parent fees in the payment coin's smallest unit.

      Returns bigint

      The internal fee in MIST as a bigint.

    • Returns the staked mix fee from a wrapper.

      Plain SuiFrens and undefined return undefined.

      Parameters

      Returns bigint | undefined

      The staked fee in the payment coin's smallest unit, or undefined.