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

    Low-level SuiFrens object, event, inspection, and transaction-builder API.

    Read methods use the configured gRPC or API helpers. Event methods that call fetchCastEventsWithCursor require the optional JSON-RPC client on AftermathApi. Transaction-command methods append Move calls only; builder methods create unsigned transactions for a caller-supplied wallet address.

    Index

    Package and shared-object addresses used by SuiFrens operations.

    eventTypes: {
        harvestSuiFrenFees: string;
        mixSuiFrens: string;
        stakeSuiFren: string;
        unstakeSuiFren: string;
    }

    Move event types used by the four public event fetchers.

    Type Declaration

    • harvestSuiFrenFees: string

      Harvested-fees event type.

    • mixSuiFrens: string

      Mixed-SuiFren event type.

    • stakeSuiFren: string

      Staked-SuiFren event type.

    • unstakeSuiFren: string

      Unstaked-SuiFren event type.

    fetchStakeTx: (
        inputs: { walletAddress: string } & Omit<
            {
                baseFee: bigint;
                feeIncrementPerMix: bigint;
                minRemainingMixesToKeep: bigint;
                suiFrenId: string;
                suiFrenType: string;
                tx: Transaction;
            },
            "tx",
        >,
    ) => Transaction = ...

    Creates a new unsigned staking transaction with walletAddress as sender.

    The builder appends stake_and_keep with autoStakeFees: true. It performs no network I/O and does not select an explicit payment coin.

    Type Declaration

      • (
            inputs: { walletAddress: string } & Omit<
                {
                    baseFee: bigint;
                    feeIncrementPerMix: bigint;
                    minRemainingMixesToKeep: bigint;
                    suiFrenId: string;
                    suiFrenType: string;
                    tx: Transaction;
                },
                "tx",
            >,
        ): Transaction
      • Parameters

        • inputs: { walletAddress: string } & Omit<
              {
                  baseFee: bigint;
                  feeIncrementPerMix: bigint;
                  minRemainingMixesToKeep: bigint;
                  suiFrenId: string;
                  suiFrenType: string;
                  tx: Transaction;
              },
              "tx",
          >

          Wallet sender, SuiFren ID, fee settings, minimum count, and generic type.

        Returns Transaction

        A new unsigned Sui Transaction.

    fetchUnstakeTx: (
        inputs: { walletAddress: string } & Omit<
            { stakedPositionId: string; suiFrenType: string; tx: Transaction },
            "tx",
        >,
    ) => Transaction = ...

    Creates a new unsigned unstaking transaction with walletAddress as sender.

    Type Declaration

      • (
            inputs: { walletAddress: string } & Omit<
                { stakedPositionId: string; suiFrenType: string; tx: Transaction },
                "tx",
            >,
        ): Transaction
      • Parameters

        • inputs: { walletAddress: string } & Omit<
              { stakedPositionId: string; suiFrenType: string; tx: Transaction },
              "tx",
          >

          Wallet sender, staked-position ID, and generic SuiFren type.

        Returns Transaction

        A new unsigned Sui Transaction.

    objectTypes: {
        bullshark: string;
        capy: string;
        stakedSuiFrenMetadataV1: string;
        stakedSuiFrenPosition: string;
        suiFren: string;
        suiFrenAccessory: string;
    }

    Move object types used by SuiFrens object and dynamic-field reads.

    Type Declaration

    • bullshark: string

      Bullshark object type.

    • capy: string

      Capy object type.

    • stakedSuiFrenMetadataV1: string

      Version-one staked metadata dynamic-field type.

    • stakedSuiFrenPosition: string

      Staked-position object type.

    • suiFren: string

      Base SuiFren generic object type.

    • suiFrenAccessory: string

      Accessory object type.

    • Appends the owned-SuiFren add_accessory_to_owned_suifren Move call.

      Parameters

      • inputs: { accessoryId: string; suiFrenId: string; suiFrenType: string; tx: Transaction }

        Existing transaction, SuiFren ID, accessory ID, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the staked-position add_accessory Move call.

      Parameters

      • inputs: { accessoryId: string; suiFrenId: string; suiFrenType: string; tx: Transaction }

        Existing transaction, SuiFren ID, accessory ID, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the vault begin_harvest Move call.

      Parameters

      • inputs: { tx: Transaction }

        Existing transaction to mutate.

      Returns TransactionResult

      The transaction argument used as harvest metadata.

    • Appends the vault metadata-ID inspection call to an existing transaction.

      The call returns a vector<address> in dev inspection output. This method only mutates tx; it does not set a sender, perform inspection, or sign.

      Parameters

      • inputs: { suiFrenIds: string[]; tx: Transaction }

        Existing transaction and SuiFren IDs to inspect.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the batched mixing-limit and last-epoch inspection call.

      The Move call returns vector<Option<u8>> and vector<Option<u64>> for dev-inspection decoding. This method only mutates the supplied transaction.

      Parameters

      • inputs: { suiFrenIds: string[]; suiFrenType: string; tx: Transaction }

        Existing transaction, SuiFren IDs, and generic SuiFren type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the vault end_harvest Move call.

      Parameters

      • inputs: { harvestFeesEventMetadataId: string | TransactionArgument; tx: Transaction }

        Existing transaction and metadata ID or transaction argument.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Fetches all accessories attached to one SuiFren through dynamic fields.

      This method returns all matching fields without exposing a page cursor.

      Parameters

      • inputs: { suiFrenId: string }

        SuiFren parent object ID.

      Returns Promise<SuiFrenAccessoryObject[]>

      Accessory objects attached to the parent.

      Errors from dynamic-field listing, object reads, or casting.

    • Builds an unsigned accessory-add transaction for an owned or staked SuiFren.

      isOwned selects add_accessory_to_owned_suifren when true and add_accessory when false. The returned transaction has walletAddress as sender.

      Parameters

      Returns Transaction

      A new unsigned Sui Transaction.

    • Builds an unsigned fee-harvest transaction for one or more positions.

      The transaction begins harvest, harvests each position, merges multiple harvested coins, transfers the resulting coin to walletAddress, and ends harvest. The implementation expects at least one position ID.

      Parameters

      • inputs: { stakedPositionIds: string[]; walletAddress: string }

        Wallet sender/recipient and a non-empty list of position IDs.

      Returns Promise<Transaction>

      An unsigned Sui Transaction with the sender set.

      Errors from the Sui transaction builder when the input list is empty or an argument is invalid.

    • Builds an unsigned mix transaction and selects the correct parent-state branch.

      The method sets walletAddress as sender, adds baseFee to the internal fee calculated from the optional parent mixFee values, and selects a SUI coin for the total. It calls the owned, mixed-owned/staked, or staked/staked Move function according to which parent fees are defined. isSponsoredTx is passed to coin selection.

      Parameters

      • inputs: ApiMixSuiFrensBody

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

      Returns Promise<Transaction>

      An unsigned Sui Transaction with the sender set.

      Errors from coin selection, the provider, or transaction building.

    • Builds an unsigned accessory-removal transaction.

      The union discriminant selects the owned-SuiFren call when suiFrenId is present and the staked-position call otherwise. The returned transaction has walletAddress as sender.

      Parameters

      Returns Transaction

      A new unsigned Sui Transaction.

    • Reads one SuiFren's optional last-mixed epoch through dev inspection.

      Bullshark objects return undefined without creating an inspection call. Other values decode from Option<u64> to bigint.

      Parameters

      • inputs: { suiFrenId: string; suiFrenType: string }

        SuiFren ID and generic type used by the Move call.

      Returns Promise<bigint | undefined>

      The epoch number as a bigint, or undefined when absent.

      Errors from the inspection client, BCS decoding, or transaction builder.

    • Reads one SuiFren's optional mixing limit through dev inspection.

      Bullshark objects return undefined without creating an inspection call because the current implementation does not expose a mixing-limit field for that type.

      Parameters

      • inputs: { suiFrenId: string; suiFrenType: string }

        SuiFren ID and generic type used by the Move call.

      Returns Promise<bigint | undefined>

      The limit as a bigint, or undefined when the type or on-chain option has no value.

      Errors from the inspection client, BCS decoding, or transaction builder.

    • Reads mixing limits and last-mixed epochs for several SuiFrens in one dev-inspection transaction.

      The returned array matches suiFrenIds by index. mixLimit decodes Option<u8> and lastEpochMixed decodes Option<u64>; absent values are returned as undefined and present values as bigint.

      Parameters

      • inputs: { suiFrenIds: string[]; suiFrenType: string }

        SuiFren IDs and the generic type used by the inspection call.

      Returns Promise<{ lastEpochMixed: bigint | undefined; mixLimit: bigint | undefined }[]>

      One { mixLimit, lastEpochMixed } result per input ID.

      Errors from the inspection client, BCS decoding, or transaction builder.

    • Fetches accessory objects owned by a wallet.

      Parameters

      • inputs: { walletAddress: string }

        Wallet address whose accessory objects are listed.

      Returns Promise<SuiFrenAccessoryObject[]>

      Owned accessory objects with display data.

      Errors from the object client or response caster.

    • Fetches staked SuiFrens and their owned position objects for a wallet.

      The method lists owned staked positions, resolves their metadata IDs through dev inspection, and combines each position with its staked metadata.

      Parameters

      • inputs: { walletAddress: string }

        Wallet address whose staked-position objects are listed.

      Returns Promise<StakedSuiFrenInfo[]>

      Staked info with the matching position field populated.

      Errors from owned-object reads, dev inspection, BCS decoding, or casting.

    • Fetches complete SuiFrens owned by a wallet.

      The method reads ordinary owned SuiFrens and also traverses owned kiosk owner caps to find Bullshark objects. Returned objects do not include an ownership flag; the high-level facade wraps them with isOwned: true.

      Parameters

      • inputs: { walletAddress: string }

        Wallet address whose SuiFren and kiosk objects are read.

      Returns Promise<SuiFrenObject[]>

      Complete owned SuiFren objects.

      Errors from object, dynamic-field, inspection, or kiosk reads.

    • Resolves staked-metadata object IDs for a list of SuiFren IDs.

      The method builds a dev-inspection call that returns a vector<address> and decodes those addresses as object IDs.

      Parameters

      • inputs: { suiFrenIds: string[] }

        SuiFren object IDs to resolve.

      Returns Promise<string[]>

      Staked metadata object IDs in the Move call's returned order.

      Errors from the inspection client, BCS decoding, or transaction builder.

    • Fetches complete staked SuiFrens by metadata object ID.

      stakedSuiFrenIds are metadata IDs from the vault table, not owned staked-position IDs. The returned info contains the SuiFren and metadata; position is left unset by this method.

      Parameters

      • inputs: { stakedSuiFrenIds: string[] }

        Staked metadata object IDs.

      Returns Promise<StakedSuiFrenInfo[]>

      Staked SuiFren info in the response order.

      Errors from object reads, inspection, BCS decoding, or casting.

    • Fetches staked SuiFrens until enough locally filtered results are available.

      limit is the number of matching results to return and defaults to 25. limitStepSize controls each underlying dynamic-field page and defaults to the dynamic-field helper's page size. Attribute keys and values are matched case-insensitively. If more matches remain, nextCursor is set to the first omitted matching object's ID. sortBy is accepted for compatibility but is not applied by the current implementation.

      Parameters

      • inputs: {
            attributes: Partial<SuiFrenAttributes>;
            cursor?: string;
            limit?: number;
            limitStepSize?: number;
            sortBy?: SuiFrensSortOption;
        }

        Attribute filters and pagination controls.

      Returns Promise<DynamicFieldObjectsWithCursor<StakedSuiFrenInfo>>

      Filtered staked info objects and a cursor for the next filtered page.

      Errors from dynamic-field reads, object reads, inspection, or casting.

    • Fetches complete SuiFren objects by ID.

      The method first reads object fields and display data, then performs the inspection calls needed to add mixLimit and lastEpochMixed. Values that are absent on chain remain undefined.

      Parameters

      • inputs: { suiFrenIds: string[] }

        SuiFren object IDs.

      Returns Promise<SuiFrenObject[]>

      Complete SuiFren objects in the response order.

      Errors from object reads, dev inspection, BCS decoding, or casting.

    • Calculates SuiFrens statistics from vault state and the last 24 hours of mix events.

      The method performs the vault read and event query concurrently. The event query uses the provider's JSON-RPC client through the public event fetcher.

      Returns Promise<SuiFrenStats>

      Vault totals, 24-hour fee sum, and 24-hour mix count.

      Errors from object reads, event queries, or event casting.

    • Filters SuiFren objects by attribute keys and values.

      Matching is case-insensitive for both keys and values. An empty attribute object returns the original suiFrens array reference; a non-empty filter returns a new filtered array.

      Parameters

      Returns SuiFrenObject[]

      The matching objects.

    • Appends a vault harvest Move call for one staked position.

      harvestFeesEventMetadataId may be an object ID or a transaction argument returned by beginHarvestTx.

      Parameters

      • inputs: {
            harvestFeesEventMetadataId: string | TransactionArgument;
            stakedPositionId: string;
            tx: Transaction;
        }

        Existing transaction, position ID, and harvest metadata argument.

      Returns TransactionResult

      The transaction argument containing the harvested coin.

    • Appends the last_epoch_mixed Move call for one SuiFren.

      The result is an Option<u64> in the Move call output. This local builder only mutates tx and does not perform the inspection itself.

      Parameters

      • inputs: { suiFrenId: string; suiFrenType: string; tx: Transaction }

        Existing transaction, SuiFren ID, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the owned-parent mix_and_keep Move call.

      The payment coin may be an object ID or an existing transaction argument. The method does not select the coin, set a sender, transfer outputs, or sign.

      Parameters

      • inputs: {
            parentOneId: string;
            parentTwoId: string;
            suiFrenType: string;
            suiPaymentCoinId: string | TransactionArgument;
            tx: Transaction;
        }

        Existing transaction, two parent IDs, payment coin, and SuiFren type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the mixing_limit Move call for one SuiFren.

      The result is an Option<u8> in the Move call output. This local builder only mutates tx and does not perform the inspection itself.

      Parameters

      • inputs: { suiFrenId: string; suiFrenType: string; tx: Transaction }

        Existing transaction, SuiFren ID, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the mix_staked_with_staked_and_keep Move call.

      The payment coin may be an object ID or an existing transaction argument.

      Parameters

      • inputs: {
            parentOneId: string;
            parentTwoId: string;
            suiFrenType: string;
            suiPaymentCoinId: string | TransactionArgument;
            tx: Transaction;
        }

        Existing transaction, two staked parent IDs, payment coin, and SuiFren type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the mix_with_staked_and_keep Move call.

      nonStakedParentId and stakedParentId select the parent roles in the Move call. The payment coin may be an object ID or transaction argument.

      Parameters

      • inputs: {
            nonStakedParentId: string;
            stakedParentId: string;
            suiFrenType: string;
            suiPaymentCoinId: string | TransactionArgument;
            tx: Transaction;
        }

        Existing transaction, parent IDs, payment coin, and SuiFren type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the staked-position remove_accessory_and_keep Move call.

      Parameters

      • inputs: {
            accessoryType: string;
            stakedPositionId: string;
            suiFrenType: string;
            tx: Transaction;
        }

        Existing transaction, staked-position ID, accessory type, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the owned-SuiFren remove_accessory_from_owned_suifren_and_keep call.

      Parameters

      • inputs: {
            accessoryType: string;
            suiFrenId: string;
            suiFrenType: string;
            tx: Transaction;
        }

        Existing transaction, SuiFren ID, accessory type, and generic type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the stake_and_keep Move call.

      baseFee and feeIncrementPerMix are raw payment-coin balances. The Move call encodes minRemainingMixesToKeep as u8. This method does not set a sender or select gas and payment objects.

      Parameters

      • inputs: {
            autoStakeFees: boolean;
            baseFee: bigint;
            feeIncrementPerMix: bigint;
            minRemainingMixesToKeep: bigint;
            suiFrenId: string;
            suiFrenType: string;
            tx: Transaction;
        }

        Existing transaction, SuiFren ID, fee settings, auto-stake flag, minimum count, and type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.

    • Appends the unstake_and_keep Move call for a staked position.

      This method only mutates the supplied transaction. The caller must provide a position object usable by the transaction sender.

      Parameters

      • inputs: { stakedPositionId: string; suiFrenType: string; tx: Transaction }

        Existing transaction, staked-position ID, and SuiFren type.

      Returns TransactionResult

      The transaction argument returned by tx.moveCall.