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

    Provides low-level wallet queries through a configured AftermathApi.

    Balance methods call the configured SuiGrpcClient and return on-chain balances as bigints in smallest units. Transaction history uses the optional JSON-RPC client because the Sui gRPC client has no equivalent query. None of these methods accepts an AbortSignal.

    Prefer AftermathApi.Wallet when the caller already has an AftermathApi instance.

    Index
    • Creates a low-level wallet query helper.

      Parameters

      • api: AftermathApi

        Configured AftermathApi whose gRPC client supplies balance data and whose optional JSON-RPC client supplies transaction history.

      Returns WalletApi

      import { AftermathApi } from "aftermath-ts-sdk";
      import { SuiGrpcClient } from "@mysten/sui/grpc";

      const api = new AftermathApi(
      new SuiGrpcClient({
      network: "mainnet",
      baseUrl: "https://fullnode.mainnet.sui.io:443",
      }),
      {}
      );
      const walletApi = api.Wallet();
    • Fetches every coin balance for a wallet address through paginated Sui gRPC requests.

      The helper follows listBalances cursors until the client reports no next page. It returns each balance as a bigint in the coin's smallest unit and pads the package address in each returned coin type to 64 hexadecimal digits.

      This method does not accept an AbortSignal.

      Parameters

      • inputs: { walletAddress: string }

        The wallet balance request.

        • walletAddress: string

          The Sui address string whose balances to fetch.

      Returns Promise<CoinsToBalance>

      A record keyed by normalized coin types with balances in smallest units.

      Errors from the configured gRPC client, coin-type normalization, or conversion of a returned balance to bigint.

    • Fetches one coin balance for a wallet address through Sui gRPC.

      The owner address is sent unchanged. The coin type is stripped of leading zeroes before it is sent to SuiGrpcClient.getBalance. The returned decimal balance is converted to a bigint in the coin's smallest unit.

      This method does not accept an AbortSignal.

      Parameters

      • inputs: { coin: string; walletAddress: string }

        The wallet balance request.

        • coin: string

          The Sui coin type to query, such as "0x2::sui::SUI".

        • walletAddress: string

          The Sui address string that owns the balance.

      Returns Promise<bigint>

      The balance in the coin's smallest unit.

      Errors from the configured gRPC client or from converting the returned balance to bigint.

    • Fetches a page of transactions whose sender is the supplied wallet address.

      This method calls Transactions().fetchTransactionsWithCursor with a FromAddress filter. It requests events, balance changes, effects, object changes, and transaction input in each result. The optional cursor and limit control pagination, and the returned nextCursor is null when no page remains.

      This method does not accept an AbortSignal.

      Parameters

      • inputs: { cursor?: string; limit?: number; walletAddress: string }

        The sender filter and pagination options.

        • Optionalcursor?: string

          An optional transaction digest from the previous page.

        • Optionallimit?: number

          An optional maximum number of transactions to request.

        • walletAddress: string

          The Sui address string used as the FromAddress filter. This method does not include transactions where the address only appears as a recipient or another participant.

      Returns Promise<TransactionsWithCursor>

      The transaction page and its next transaction digest, if another page exists.

      This method uses the remaining Sui JSON-RPC transaction-query surface. Prefer Wallet.getPastTransactions for the Aftermath API transaction-history endpoint.

      Error if the AftermathApi has no JSON-RPC client.

      Errors from the configured JSON-RPC client when the query fails.