@aave/aave-v3-aptos-ts-sdk - v0.0.53
    Preparing search index...

    Class EmissionManagerClient

    The EmissionManagerClient class provides methods to interact with the emission management system of the Aave protocol on the Aptos blockchain. It extends the AptosContractWrapperBaseClass and includes functionalities for configuring rewards, managing emission rates, and controlling distribution parameters.

    This client is designed to work with the emission management contracts and provides a high-level API for reward configuration and management. The client can be instantiated in two ways:

    1. Using the constructor directly with a provider and optional signer
    2. Using the static buildWithDefaultSigner method which automatically configures the client with the provider's pool profile account
    // Using buildWithDefaultSigner
    const provider = new AptosProvider();
    const client = EmissionManagerClient.buildWithDefaultSigner(provider);

    // Using constructor directly
    const provider = new AptosProvider();
    const signer = provider.getPoolProfileAccount();
    const client = new EmissionManagerClient(provider, signer);

    // Configure asset emissions
    const tx = await client.configureAssets(
    [1000n], // emissionsPerSecond
    [2000n], // maxEmissionRates
    [1735689600n], // distributionEnds
    [assetAddress], // assets
    [rewardAddress], // rewards
    [strategyAddress] // pullRewardsTransferStrategies
    );

    The AptosProvider instance used to interact with the Aptos blockchain.

    Optional Ed25519Account signer for transaction signing.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    peripheryContract: PeripheryContract

    Methods

    • Builds a transaction for the specified user, function, and arguments.

      Parameters

      • user: AccountAddress

        The account address of the user initiating the transaction.

      • functionId: `${string}::${string}::${string}`

        The identifier of the Move function to be called.

      • funcArgs: (EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes)[]

        An array of arguments for the entry function.

      • typeArgs: string[] = []

      Returns Promise<SimpleTransaction>

      A promise that resolves to a SimpleTransaction object.

    • Calls a view method on the Aptos blockchain.

      Type Parameters

      • T extends MoveValue[]

        The type of the return value, which extends an array of MoveValue.

      Parameters

      • functionId: `${string}::${string}::${string}`

        The identifier of the function to call.

      • funcArgs: (EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes)[]

        The arguments to pass to the function.

      • typeArgs: string[] = []

        Optional generic type arguments for the function (e.g. ["0x1::aptos_coin::AptosCoin"]).

      Returns Promise<T>

      • A promise that resolves to the result of the view method call.
    • Configures multiple assets with their emission parameters

      Parameters

      • emissionsPerSecond: bigint[]

        The emission rates per second for each asset

      • maxEmissionRates: bigint[]

        The maximum emission rates for each asset

      • distributionEnds: bigint[]

        The distribution end timestamps for each asset

      • assets: AccountAddress[]

        The addresses of the assets to configure

      • rewards: AccountAddress[]

        The addresses of the rewards for each asset

      • pullRewardsTransferStrategies: AccountAddress[]

        The transfer strategies for pulling rewards

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse.

    • Gets the address of the emission manager

      Returns Promise<AccountAddress>

      The address of the emission manager object

    • Gets the emission manager object

      Returns Promise<AccountAddress>

      The emission manager object

    • Funds an account with a specified amount.

      Parameters

      • account: AccountAddress

        The address of the account to be funded.

      • amount: bigint

        The amount to fund the account with, in bigint.

      Returns Promise<UserTransactionResponse>

      A promise that resolves to a UserTransactionResponse.

    • Retrieves the Aptos balance of a specified account.

      Parameters

      • account: Ed25519Account

        The Ed25519 account object.

      • accountAddress: AccountAddress

        The address of the account to retrieve the balance for.

      • OptionalversionToWaitFor: bigint

        (Optional) The specific version to wait for before retrieving the balance.

      Returns Promise<bigint>

      A promise that resolves to the balance of the account in bigint.

    • Gets the emission admin for a reward

      Parameters

      • reward: AccountAddress

        The address of the reward

      Returns Promise<AccountAddress>

      The address of the emission admin

    • Retrieves events associated with a specific account.

      Parameters

      • account: AccountAddress

        The address of the account to retrieve events for.

      • limit: number

        The maximum number of events to retrieve.

      Returns Promise<
          {
              account_address: string;
              creation_number: any;
              data: any;
              event_index: any;
              indexed_type: string;
              sequence_number: any;
              transaction_block_height: any;
              transaction_version: any;
              type: string;
          }[],
      >

      A promise that resolves to an array of event objects, each containing:

      • account_address: The address of the account.
      • creation_number: The creation number of the event.
      • data: The data associated with the event.
      • event_index: The index of the event.
      • sequence_number: The sequence number of the event.
      • transaction_block_height: The block height of the transaction.
      • transaction_version: The version of the transaction.
      • type: The type of the event.
      • indexed_type: The indexed type of the event.
    • Gets the rewards controller

      Returns Promise<AccountAddress>

      The address of the rewards controller (or undefined if not set)

    • Retrieves the events associated with a given transaction hash.

      Parameters

      • txHash: HexInput

        The hash of the transaction to retrieve events for.

      Returns Promise<{ data: unknown }[]>

      A promise that resolves to an array of objects containing the event data.

      This method fetches the transaction details using the provided Aptos provider. It then checks if the transaction response is of type BlockMetadataTransactionResponse or UserTransactionResponse to extract the events. The event data is parsed from JSON and returned in an array.

    • Sends a transaction and awaits the response.

      Parameters

      • functionId: `${string}::${string}::${string}`

        The ID of the Move function to be called.

      • funcArgs: (EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes)[]

        An array of arguments for the entry function.

      • typeArgs: string[] = []

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to the committed transaction response.

    • Sets the emission admin for a reward, Only callable by the admin

      Parameters

      • reward: AccountAddress

        The address of the reward

      • newAdmin: AccountAddress

        The address of the new admin

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse

    • Sets a claimer for a user, Only callable by the admin

      Parameters

      • user: AccountAddress

        The address of the user

      • claimer: AccountAddress

        The address of the claimer

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse

    • Sets the distribution end timestamp for a reward on an asset, Only callable by the emission admin for the reward

      Parameters

      • asset: AccountAddress

        The address of the asset

      • reward: AccountAddress

        The address of the reward

      • newDistributionEnd: bigint

        The new distribution end timestamp

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse

    • Sets the emission rate per second for rewards on an asset, Only callable by the emission admin for all rewards

      Parameters

      • asset: AccountAddress

        The address of the asset

      • rewards: AccountAddress[]

        The addresses of the rewards

      • newEmissionsPerSecond: bigint[]

        The new emission rates per second

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse

    • Sets the pull rewards transfer strategy for a reward, Only callable by the emission admin for the reward

      Parameters

      • reward: AccountAddress

        The address of the reward

      • pullRewardsTransferStrategy: AccountAddress

        The transfer strategy for pulling rewards

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse

    • Sets the rewards controller address, Only callable by the admin

      Parameters

      • OptionalrewardsController: AccountAddress

        The new rewards controller address (optional)

      Returns Promise<CommittedTransactionResponse>

      A promise that resolves to a CommittedTransactionResponse