aftermath-ts-sdk - v6.7.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 the wallet's volume and effective perpetuals fee rates for the running rewards epoch.

      Rates are fractions of notional (0.0001 is 1 bp) decided by the volume the wallet has traded this epoch. The maker rate already nets out the maker rebate tier, so it can be negative. Zero volumes do not prove the wallet has not traded: the API returns the same answer while the running epoch's volumes are still loading.

      Parameters

      Returns Promise<ApiRewardsGetFeeRateResponse>

      The running epoch, maker and taker volume in USD, and the effective maker and taker fee rates.

      AftermathTransportError when the API request or response fails.

      const { takerFeeRate, makerFeeRate } = await rewards.getFeeRate({
      walletAddress: "0x...",
      });
    • Fetches the running epoch's perpetuals fee schedule: the taker and maker volume tiers, the maker rebate tiers, and the epoch bounds. The schedule is the same for every wallet; pair it with getFeeRate to place a wallet on it.

      Returns Promise<ApiRewardsGetFeeScheduleResponse>

      The running epoch, its start and end, and the tiers in ascending order.

      AftermathTransportError when the API request or response fails.

      const { takerFeeTiers, epochEndTimestampMs } =
      await rewards.getFeeSchedule();
    • 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.