import { BigNumberish, BytesLike, ContractTransaction, ContractTransactionResponse, Provider } from 'ethers'; import { IPremiaStaking, PremiaStakingStorage, VxPremiaStorage } from '@premia/v3-abi/typechain/IVxPremia'; import { BaseAPI } from './baseAPI'; import { Signature, StakeHistory, TransactionData, UserStake, VaultVote, Vote, VoteHistory } from '../entities'; /** * @class * This class provides additional functionalities specific to the Premia Protocol. * This class exposes methods to interact with the Premia Protocol's user-related functionalities such as vault votes, * user stakes, stake histories and voting histories. * * @extends BaseAPI */ export declare class VxPremiaAPI extends BaseAPI { /** * Retrieves vault votes for a given user. * * @param {string} user - The user's address. * @param {number} [limit=100] - The maximum number of records to retrieve. * @param {number} [skip=0] - The number of records to skip. * @returns {Promise} A promise that resolves to an array of vault votes. */ getVaultVotes(user: string, limit?: number, skip?: number): Promise; /** * Retrieves vault votes for a given user and timestamp range. * * @param {string} user - The user's address. * @param {number} timestampFrom - The start timestamp for the range. * @param {number} timestampTo - The end timestamp for the range. * @param {number} [limit=100] - The maximum number of records to retrieve. * @param {number} [skip=0] - The number of records to skip. * @returns {Promise} A promise that resolves to an array of vault votes. */ getUserVaultVotesFromTimestamp(user: string, timestampFrom: number, timestampTo: number, limit?: number, skip?: number): Promise; /** * Retrieves all the last vault votes. * * @param {string} orderBy - The field to order the results by. * @param {string} order - The order direction ('ASC' or 'DESC'). * @param {number} [limit=100] - The maximum number of records to retrieve. * @param {number} [skip=0] - The number of records to skip. * @returns {Promise} A promise that resolves to an array of vault votes. */ getAllLastVaultVotes(orderBy: string, order: string, limit?: number, skip?: number): Promise; /** * Retrieves vote history for a given id. * * @param {string} id - The id of the vote. * @returns {Promise} A promise that resolves to the vote history. */ getVoteHistory(id: string): Promise; /** * Retrieves the last user stakes. * * @returns {Promise} A promise that resolves to an array of user stakes. */ getLastUserStakes(): Promise; /** * Retrieves user stakes for a given start time. * * @param {number} startTime - The start time for retrieving stakes. * @param {string} user - The user's address. * @param {number} [limit=100] - The maximum number of records to retrieve. * @param {number} [skip=0] - The number of records to skip. * @returns {Promise} A promise that resolves to an array of user stakes. */ getUserStakes(startTime: number, user: string, limit?: number, skip?: number): Promise; /** * Retrieves the last user stake from a given timestamp. * * @param {number} timestamp - The timestamp for retrieving the stake. * @param {string} user - The user's address. * @returns {Promise} A promise that resolves to an array of user stakes. */ getLastUserStakeFromTimestamp(timestamp: number, user: string): Promise; /** * Retrieves stake history for a given id. * * @param {string} id - The id of the stake. * @returns {Promise} A promise that resolves to the stake history. */ getStakeHistory(id: string): Promise; /** * Retrieves stake histories for a given start time. * * @param {number} startTime - The start time for retrieving stake histories. * @param {number} [limit=100] - The maximum number of records to retrieve. * @param {number} [skip=0] - The number of records to skip. * @returns {Promise} A promise that resolves to an array of stake histories. */ getStakeHistories(startTime: number, limit?: number, skip?: number): Promise; /** * Retrieves the total number of votes associated with a specific vault. * * @param {string} vaultAddress - The Ethereum address of the vault. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the total number of votes. */ getVotesForVault(vaultAddress: string, provider?: Provider): Promise; /** * Retrieves all votes a particular user has cast. * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to an array of VoteStructOutput instances representing each vote the user has cast. */ getUserVotes(user: string, provider?: Provider): Promise; /** * Retrieves the total amount of available rewards. * * @params {Provider} provider - The custom provider to use for this call. * @returns {Promise<[bigint, bigint] & {rewards: bigint, unstakeRewards: bigint}>} - A promise that resolves to the amount of * available rewards and unstake rewards respectively. */ getAvailableRewards(provider?: Provider): Promise<[ bigint, bigint ] & { rewards: bigint; unstakeRewards: bigint; }>; /** * Calculates the total amount of rewards that are pending distribution. * * @params {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a the total amount of pending rewards. */ getPendingRewards(provider?: Provider): Promise; /** * Retrieves the amount of rewards that are pending for a specific user. * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise<[bigint, bigint] & {reward: bigint, unstakeReward: bigint}>} - A promise that resolves to the amount of rewards * and unstake rewards that are pending for the user respectively. */ getPendingUserRewards(user: string, provider?: Provider): Promise<[bigint, bigint] & { reward: bigint; unstakeReward: bigint; }>; /** * Gets the fee percentage a user would have to pay to unstake early. * (fee percentage * lock amount = fee amount) * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to fee percentage for unstaking early. */ getEarlyUnstakeFee(user: string, provider?: Provider): Promise; /** * Gets the total power across all users (applying the bonus from lockup period chosen) * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the total power across all users */ getTotalPower(provider?: Provider): Promise; /** * Gets the power associated with a specific user. * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the user's power. */ getUserPower(user: string, provider?: Provider): Promise; /** * Gets the discount a user receives. * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the user's discount. */ getDiscount(user: string, provider?: Provider): Promise; /** * Gets the information of a user. * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a UserInfoStructOutput * instance representing the user's information. */ getUserInfo(user: string, provider?: Provider): Promise; /** * Gets the total amount of withdrawals. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the total amount of pending withdrawals. */ getPendingWithdrawals(provider?: Provider): Promise; /** * Retrieves the information of a pending withdrawal of a user. * * @param {string} user - The address of the user. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise<[bigint, bigint, bigint] & {amount: bigint, startDate: bigint, unlockDate: bigint}>} - A promise that resolves to the * amount, start date, and unlock date of the user's pending withdrawal respectively. */ getPendingWithdrawal(user: string, provider?: Provider): Promise<[ bigint, bigint, bigint ] & { amount: bigint; startDate: bigint; unlockDate: bigint; }>; /** * Gets the stake levels. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A Promise that resolves to a ContractTransactionResponse * instance representing the stake levels. */ getStakeLevels(provider?: Provider): Promise; /** * Gets the stake period multiplier. * * @param {BigNumberish} period - The duration (in seconds) for which tokens are locked * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - Returns a Promise that resolves to the multiplier for this * staking period */ getStakePeriodMultiplier(period: BigNumberish, provider?: Provider): Promise; /** * Gets the available amount of Premia. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves the available amount of Premia. */ getAvailablePremiaAmount(provider?: Provider): Promise; /** * Estimates the fee for bridging vxPREMIA to the destination chain. * * @param {BigNumberish} destinationChainId - The id of the destination chain. * @param {string} toAddress - The address to which the tokens will be sent. * @param {BigNumberish} amount - The amount of tokens to be sent. * @param {boolean} useZro - Whether to use ZRO or not. * @param {BytesLike} adapterParams - The adapter params. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise<[bigint, bigint] & { nativeFee: bigint; zroFee: bigint; }>} - A promise that resolves to the * fee for bridging vxPREMIA to the destination chain. */ estimateSendFee(destinationChainId: BigNumberish, toAddress: string, amount: BigNumberish, useZro: boolean, adapterParams: BytesLike, provider?: Provider): Promise<[bigint, bigint] & { nativeFee: bigint; zroFee: bigint; }>; /** * Encodes a transaction to bridge vxPREMIA tokens to the destination chain. * * @param {string} from - The address from which the tokens will be sent. * @param {BigNumberish} destinationChainId - The id of the destination chain. * @param {string} toAddress - The address to which the tokens will be sent. * @param {BigNumberish} amount - The amount of tokens to be sent. * @param {string} refundAddress - The address to which the tokens will be refunded in case of failure. * @param {string} zroPaymentAddress - The address to which the ZRO payment will be sent. * @param {BytesLike} adapterParams - The adapter params. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeSendFrom(from: string, destinationChainId: BigNumberish, toAddress: string, amount: BigNumberish, refundAddress: string, zroPaymentAddress: string, adapterParams: BytesLike, provider?: Provider): Promise; /** * Encodes a transaction to bridge vxPREMIA tokens to the destination chain. * * @param {string} from - The address from which the tokens will be sent. * @param {BigNumberish} destinationChainId - The id of the destination chain. * @param {string} toAddress - The address to which the tokens will be sent. * @param {BigNumberish} amount - The amount of tokens to be sent. * @param {string} refundAddress - The address to which the tokens will be refunded in case of failure. * @param {string} zroPaymentAddress - The address to which the ZRO payment will be sent. * @param {BytesLike} adapterParams - The adapter params. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeSendFromSync(from: string, destinationChainId: BigNumberish, toAddress: string, amount: BigNumberish, refundAddress: string, zroPaymentAddress: string, adapterParams: BytesLike, provider?: Provider): TransactionData; /** * Bridges vxPREMIA tokens to the destination chain. * @param {string} from - The address from which the tokens will be sent. * @param {BigNumberish} destinationChainId - The id of the destination chain. * @param {string} toAddress - The address to which the tokens will be sent. * @param {BigNumberish} amount - The amount of tokens to be sent. * @param {string} refundAddress - The address to which the tokens will be refunded in case of failure. * @param {string} zroPaymentAddress - The address to which the ZRO payment will be sent. * @param {BytesLike} adapterParams - The adapter params. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the transaction. */ sendFrom(from: string, destinationChainId: BigNumberish, toAddress: string, amount: BigNumberish, refundAddress: string, zroPaymentAddress: string, adapterParams: BytesLike, provider?: Provider): Promise; /** * Encodes a transaction to cast votes. * * @param {Vote[]} votes - An array of Vote instances representing the votes to be cast. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance * representing the encoded transaction. */ encodeCastVotes(votes: Vote[], provider?: Provider): Promise; /** * Encodes a transaction to cast votes. * * @param {Vote[]} votes - An array of Vote instances representing the votes to be cast. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeCastVotesSync(votes: Vote[], provider?: Provider): TransactionData; /** * Casts votes. * * @param {Vote[]} votes - An array of Vote instances representing the votes to be cast. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ castVotes(votes: Vote[], provider?: Provider): Promise; /** * Encodes a transaction to stake. * * @param {BigNumberish} amount - The amount to be staked. * @param {BigNumberish} period - The staking period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeStake(amount: BigNumberish, period: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to stake. * * @param {BigNumberish} amount - The amount to be staked. * @param {BigNumberish} period - The staking period. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeStakeSync(amount: BigNumberish, period: BigNumberish, provider?: Provider): TransactionData; /** * Stakes an amount for a certain period. * * @param {BigNumberish} amount - The amount to be staked. * @param {BigNumberish} period - The staking period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ stake(amount: BigNumberish, period: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to stake using IERC2612 permit. * * @param {BigNumberish} amount - The amount of xPremia to stake. * @param {BigNumberish} period - The lockup period (in seconds). * @param {BigNumberish} deadline - The deadline after which permit will fail. * @param {Signature} signature - The signature for the transaction. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeStakeWithPermit(amount: BigNumberish, period: BigNumberish, deadline: BigNumberish, signature: Signature, provider?: Provider): Promise; /** * Encodes a transaction to stake using IERC2612 permit. * * @param {BigNumberish} amount - The amount of xPremia to stake. * @param {BigNumberish} period - The lockup period (in seconds). * @param {BigNumberish} deadline - The deadline after which permit will fail. * @param {Signature} signature - The signature for the transaction. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeStakeWithPermitSync(amount: BigNumberish, period: BigNumberish, deadline: BigNumberish, signature: Signature, provider?: Provider): TransactionData; /** * Stake using IERC2612 permit. * * @param {BigNumberish} amount - The amount of xPremia to stake. * @param {BigNumberish} period - The lockup period (in seconds). * @param {BigNumberish} deadline - The deadline after which permit will fail. * @param {Signature} signature - The signature for the transaction. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ stakeWithPermit(amount: BigNumberish, period: BigNumberish, deadline: BigNumberish, signature: Signature, provider?: Provider): Promise; /** * Encodes a transaction to update the lock period. * * @param {BigNumberish} period - The lock period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeUpdateLock(period: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to update the lock period. * * @param {BigNumberish} period - The lock period. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeUpdateLockSync(period: BigNumberish, provider?: Provider): TransactionData; /** * Updates the lock period. * * @param {BigNumberish} period - The lock period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ updateLock(period: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to harvest and stake. * * @param {Object} options - The options for the operation. * @param {BigNumberish} options.amountOutMin - The minimum amount out. * @param {string} options.callee - The callee address. * @param {string} options.allowanceTarget - The allowance target address. * @param {string} options.data - The data for the operation. * @param {string} options.refundAddress - The refund address. * @param {BigNumberish} options.stakePeriod - The stake period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeHarvestAndStake(options: { amountOutMin: BigNumberish; callee: string; allowanceTarget: string; data: string; refundAddress: string; stakePeriod: BigNumberish; }, provider?: Provider): Promise; /** * Encodes a transaction to harvest and stake. * * @param {Object} options - The options for the operation. * @param {BigNumberish} options.amountOutMin - The minimum amount out. * @param {string} options.callee - The callee address. * @param {string} options.allowanceTarget - The allowance target address. * @param {string} options.data - The data for the operation. * @param {string} options.refundAddress - The refund address. * @param {BigNumberish} options.stakePeriod - The stake period. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeHarvestAndStakeSync(options: { amountOutMin: BigNumberish; callee: string; allowanceTarget: string; data: string; refundAddress: string; stakePeriod: BigNumberish; }, provider?: Provider): TransactionData; /** * Harvests and stakes. * * @param {Object} options - The options for the operation. * @param {BigNumberish} options.amountOutMin - The minimum amount out. * @param {string} options.callee - The callee address. * @param {string} options.allowanceTarget - The allowance target address. * @param {string} options.data - The data for the operation. * @param {string} options.refundAddress - The refund address. * @param {BigNumberish} options.stakePeriod - The stake period. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ harvestAndStake(options: { amountOutMin: BigNumberish; callee: string; allowanceTarget: string; data: string; refundAddress: string; stakePeriod: BigNumberish; }, provider?: Provider): Promise; /** * Encodes a transaction to harvest. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeHarvest(provider?: Provider): Promise; /** * Encodes a transaction to harvest. * * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeHarvestSync(provider?: Provider): TransactionData; /** * Harvests. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ harvest(provider?: Provider): Promise; /** * Encodes a transaction to unstake early. * * @param {BigNumberish} amount - The amount to be unstaked. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeEarlyUnstake(amount: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to unstake early. * * @param {BigNumberish} amount - The amount to be unstaked. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeEarlyUnstakeSync(amount: BigNumberish, provider?: Provider): TransactionData; /** * Unstakes early. * * @param {BigNumberish} amount - The amount to be unstaked. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ earlyUnstake(amount: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to start a withdrawal. * * @param {BigNumberish} amount - The amount to be withdrawn. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeStartWithdraw(amount: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to start a withdrawal. * * @param {BigNumberish} amount - The amount to be withdrawn. * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeStartWithdrawSync(amount: BigNumberish, provider?: Provider): TransactionData; /** * Starts a withdrawal. * * @param {BigNumberish} amount - The amount to be withdrawn. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ startWithdraw(amount: BigNumberish, provider?: Provider): Promise; /** * Encodes a transaction to withdraw. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransaction instance representing * the encoded transaction. */ encodeWithdraw(provider?: Provider): Promise; /** * Encodes a transaction to withdraw. * * @param {Provider} provider - The custom provider to use for this call. * @returns {TransactionData} - The encoded transaction data. */ encodeWithdrawSync(provider?: Provider): TransactionData; /** * Withdraws. * * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to a ContractTransactionResponse * instance representing the result of the transaction. */ withdraw(provider?: Provider): Promise; }