aftermath-ts-sdk - v6.1.0
    Preparing search index...

    Provides HTTP access to reward points, reward history, claimable balances, and claim transaction builders.

    Read methods request data from the configured Aftermath API. The claim method also converts the API's serialized transaction response into a Sui Transaction; it does not sign or execute that transaction.

    Hierarchy (View Summary)

    Index

    Optional provider used to serialize a caller-supplied claim transaction.

    config: CallerConfig

    The mutable configuration used for subsequent requests.

    • Requests a reward-claim transaction and restores it as a Sui Transaction.

      If tx is supplied, this method serializes only its TransactionKind via AftermathApi.Transactions().fetchBase64TxKindFromTx and sends that txKind to the API. If tx is omitted, the request can still succeed with a backend-generated transaction. When the response includes a sponsorSignature, the returned bytes are parsed as a full transaction; otherwise they are parsed as a transaction kind. The returned transaction is not signed or executed by this method.

      Parameters

      • inputs: {
            coinTypes?: string[];
            recipientAddress?: string;
            tx?: Transaction;
            walletAddress: string;
        }

        Wallet address, optional coin filters, recipient, and an optional transaction to extend.

      Returns Promise<Omit<ApiRewardsClaimRequestTxResponse, "txKind"> & { tx: Transaction }>

      The parsed claim transaction and any backend sponsor signature.

      AftermathTransportError when the API request or response fails.

      Error when a supplied transaction cannot be serialized or the response cannot be restored as a Sui transaction.

    • Computes the distribution of the maker and taker reward pools across perpetuals accounts.

      Returns per-account maker and taker reward allocations, fee-tier rebates and volume metrics. When accountIds is omitted or empty the API includes every eligible account, so pass an explicit list to scope the result.

      Note: All data returned is for the current epoch only.

      Returns Promise<ApiRewardsDistributionResponse>

      Per-account reward and rebate breakdown for the current epoch.

      AftermathTransportError when the API request or response fails.

      const { totalQScoreFinal, rewards } = await rewards.getDistribution({
      totalMakerRewards: 10000,
      totalTakerRewards: 5000,
      calculationVariables: { ... },
      });
    • Fetches one page of the wallet's reward history.

      Pass cursor from the previous response to request the next page. The API documents a default page size of 20 and a maximum of 100 entries. Amounts in each history entry are returned as bigint values in the coin's smallest units.

      Parameters

      Returns Promise<ApiRewardsGetHistoryResponse>

      History entries and pagination metadata.

      AftermathTransportError when the API 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.