import { AccountAddress, Ed25519Account } from "@aptos-labs/ts-sdk"; import { AptosContractWrapperBaseClass } from "./baseClass"; import { AptosProvider } from "./aptosProvider"; import { UiIncentiveDataProviderContract } from "../contracts/uiIncentiveDataProvider"; /** * Represents the aggregated incentive data for a reserve. * * @typedef {Object} AggregatedReserveIncentiveData * @property {AccountAddress} underlyingAsset - The address of the underlying asset. * @property {IncentiveData} aIncentiveData - The incentive data for the aToken. * @property {IncentiveData} vIncentiveData - The incentive data for the variable debt token. */ export type AggregatedReserveIncentiveData = { underlyingAsset: AccountAddress; aIncentiveData: IncentiveData; vIncentiveData: IncentiveData; }; /** * Represents the incentive data for a specific token. * * @typedef {Object} IncentiveData * * @property {AccountAddress} tokenAddress - The address of the token. * @property {AccountAddress} incentiveControllerAddress - The address of the incentive controller. * @property {[RewardInfo]} rewardsTokenInformation - An array containing information about the rewards token. */ export type IncentiveData = { tokenAddress: AccountAddress; incentiveControllerAddress: AccountAddress; rewardsTokenInformation: [RewardInfo]; }; /** * Represents information about a reward token. * * @typedef {Object} RewardInfo * * @property {string} rewardTokenSymbol - The symbol of the reward token. * @property {AccountAddress} rewardTokenAddress - The address of the reward token. * @property {bigint} emissionPerSecond - The emission rate of the reward token per second. * @property {bigint} incentivesLastUpdateTimestamp - The timestamp of the last update to the incentives. * @property {bigint} tokenIncentivesIndex - The index of the token incentives. * @property {bigint} emissionEndTimestamp - The timestamp when the emission ends. * @property {bigint} rewardPriceFeed - The price feed of the reward token. * @property {number} rewardTokenDecimals - The number of decimals of the reward token. * @property {number} precision - The precision of the reward calculations. * @property {number} priceFeedDecimals - The number of decimals in the price feed. */ export type RewardInfo = { rewardTokenSymbol: string; rewardTokenAddress: AccountAddress; emissionPerSecond: bigint; incentivesLastUpdateTimestamp: bigint; tokenIncentivesIndex: bigint; emissionEndTimestamp: bigint; rewardPriceFeed: bigint; rewardTokenDecimals: number; precision: number; priceFeedDecimals: number; }; /** * Represents the incentive data for a user's reserve. * * @typedef {Object} UserReserveIncentiveData * @property {AccountAddress} underlyingAsset - The address of the underlying asset. * @property {UserIncentiveData} aTokenIncentivesUserData - The incentive data for the aToken. * @property {UserIncentiveData} vTokenIncentivesUserData - The incentive data for the vToken. */ export type UserReserveIncentiveData = { underlyingAsset: AccountAddress; aTokenIncentivesUserData: UserIncentiveData; vTokenIncentivesUserData: UserIncentiveData; }; /** * Represents the incentive data for a user. * * @typedef {Object} UserIncentiveData * * @property {AccountAddress} tokenAddress - The address of the token. * @property {AccountAddress} incentiveControllerAddress - The address of the incentive controller. * @property {[UserRewardInfo]} userRewardsInformation - An array containing information about user rewards. */ export type UserIncentiveData = { tokenAddress: AccountAddress; incentiveControllerAddress: AccountAddress; userRewardsInformation: [UserRewardInfo]; }; /** * Represents the reward information for a user. * * @typedef {Object} UserRewardInfo * @property {string} rewardTokenSymbol - The symbol of the reward token. * @property {AccountAddress} rewardTokenAddress - The address of the reward token. * @property {bigint} userUnclaimedRewards - The amount of unclaimed rewards for the user. * @property {bigint} tokenIncentivesUserIndex - The user's index in the token incentives. * @property {bigint} rewardPriceFeed - The price feed of the reward. * @property {number} priceFeedDecimals - The number of decimals in the price feed. * @property {number} rewardTokenDecimals - The number of decimals in the reward token. */ export type UserRewardInfo = { rewardTokenSymbol: string; rewardTokenAddress: AccountAddress; userUnclaimedRewards: bigint; tokenIncentivesUserIndex: bigint; rewardPriceFeed: bigint; priceFeedDecimals: number; rewardTokenDecimals: number; }; /** * The `UiIncentiveDataProviderClient` class provides methods to interact with the UI Incentive Data Provider contract on the Aptos blockchain. * It extends the `AptosContractWrapperBaseClass` and includes functionalities for retrieving incentive data for reserves * and users, including reward information, emission rates, and user-specific incentive data within the AAVE protocol. * * @remarks * This client is designed to work with the UI Incentive Data Provider contract and provides a high-level API for accessing * incentive-related data in a format suitable for UI applications. 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 * * @example * ```typescript * // Using buildWithDefaultSigner * const provider = new AptosProvider(); * const client = UiIncentiveDataProviderClient.buildWithDefaultSigner(provider); * * // Using constructor directly * const provider = new AptosProvider(); * const signer = provider.getPoolProfileAccount(); * const client = new UiIncentiveDataProviderClient(provider, signer); * * // Get full reserves incentive data * const { aggregatedReservesIncentivesData, userReserveIncentiveData } = * await client.getFullReservesIncentiveData(); * ``` * * @param provider - The AptosProvider instance used to interact with the Aptos blockchain. * @param signer - Optional Ed25519Account signer for transaction signing. */ export declare class UiIncentiveDataProviderClient extends AptosContractWrapperBaseClass { uiPoolDataProviderContract: UiIncentiveDataProviderContract; constructor(provider: AptosProvider, signer?: Ed25519Account); /** * Creates an instance of `UiIncentiveDataProviderClient` using the provided `AptosProvider`. * The client is initialized with the default signer obtained from the provider's pool profile account. * * @param provider - The `AptosProvider` instance used to create the client. * @returns A new instance of `UiIncentiveDataProviderClient`. */ static buildWithDefaultSigner(provider: AptosProvider): UiIncentiveDataProviderClient; /** * Fetches the full reserves incentive data from the UI Pool Data Provider contract. * * @returns {Promise<{ aggregatedReservesIncentivesData: [AggregatedReserveIncentiveData], userReserveIncentiveData: [UserReserveIncentiveData] }>} * A promise that resolves to an object containing: * - `aggregatedReservesIncentivesData`: An array of aggregated reserve incentive data. * - `userReserveIncentiveData`: An array of user reserve incentive data. */ getFullReservesIncentiveData(): Promise<{ aggregatedReservesIncentivesData: [AggregatedReserveIncentiveData]; userReserveIncentiveData: [UserReserveIncentiveData]; }>; /** * Retrieves the incentives data for all reserves. * * @returns {Promise<[AggregatedReserveIncentiveData]>} A promise that resolves to an array containing the aggregated incentives data for all reserves. * * @throws {Error} If the call to the view method fails. */ getReservesIncentivesData(): Promise<[ AggregatedReserveIncentiveData ]>; /** * Retrieves the incentives data for the user's reserves. * * @param user - The account address of the user. * @returns A promise that resolves to an array containing the user's reserve incentive data. */ getUserReservesIncentivesData(user: AccountAddress): Promise<[UserReserveIncentiveData]>; }