hm-aftermath-ts-sdk
Version:
Aftermath TypeScript SDK
233 lines • 9.8 kB
TypeScript
import { ApiPoolDepositBody, ApiPoolTradeBody, ApiPoolWithdrawBody, Balance, CoinType, CoinsToBalance, PoolDataPoint, PoolGraphDataTimeframeKey, PoolObject, PoolStats, SuiNetwork, PoolDepositEvent, PoolWithdrawEvent, PoolTradeEvent, ApiPoolAllCoinWithdrawBody, ApiIndexerEventsBody, IndexerEventsWithCursor, Percentage, SuiAddress, ObjectId } from "../../types";
import { Caller } from "../../general/utils/caller";
import { Transaction } from "@mysten/sui/transactions";
import { AftermathApi } from "../../general/providers";
/**
* Represents a pool object and provides methods for interacting with the pool.
* @class
*/
export declare class Pool extends Caller {
readonly pool: PoolObject;
readonly network?: SuiNetwork | undefined;
private readonly Provider?;
/**
* Private constants used in the class.
*/
private static readonly constants;
/**
* The pool statistics.
*/
stats: PoolStats | undefined;
/**
* Creates a new instance of the Pool class.
* @constructor
* @param {PoolObject} pool - The pool object.
* @param {SuiNetwork} [network] - The network to use.
*/
constructor(pool: PoolObject, network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
/**
* Fetches the deposit transaction for the pool.
* @async
* @param {ApiPoolDepositBody} inputs - The inputs for the method.
* @returns {Promise<Transaction>} The deposit transaction for the pool.
*/
getDepositTransaction(inputs: ApiPoolDepositBody): Promise<Transaction>;
/**
* Fetches the withdraw transaction for the pool.
* @async
* @param {ApiPoolWithdrawBody} inputs - The inputs for the method.
* @returns {Promise<Transaction>} The withdraw transaction for the pool.
*/
getWithdrawTransaction(inputs: ApiPoolWithdrawBody): Promise<Transaction>;
/**
* Fetches the all coin withdraw transaction for the pool.
* @async
* @param {ApiPoolAllCoinWithdrawBody} inputs - The inputs for the method.
* @returns {Promise<Transaction>} The all coin withdraw transaction for the pool.
*/
getAllCoinWithdrawTransaction(inputs: ApiPoolAllCoinWithdrawBody): Promise<Transaction>;
/**
* Fetches the trade transaction for the pool.
* @async
* @param {ApiPoolTradeBody} inputs - The inputs for the method.
* @returns {Promise<Transaction>} The trade transaction for the pool.
*/
getTradeTransaction(inputs: ApiPoolTradeBody): Promise<Transaction>;
getUpdateDaoFeeTransaction(inputs: {
walletAddress: SuiAddress;
daoFeePoolOwnerCapId: ObjectId;
newFeePercentage: Percentage;
}): Promise<Transaction>;
getUpdateDaoFeeRecipientTransaction(inputs: {
walletAddress: SuiAddress;
daoFeePoolOwnerCapId: ObjectId;
newFeeRecipient: SuiAddress;
}): Promise<Transaction>;
/**
* Fetches the pool statistics.
* @async
* @returns {Promise<PoolStats>} The pool statistics.
*/
getStats(): Promise<PoolStats>;
/**
* Sets the pool statistics.
* @param {PoolStats} stats - The pool statistics.
*/
setStats(stats: PoolStats): void;
/**
* Fetches the volume data for the pool.
* @async
* @param {Object} inputs - The inputs for the method.
* @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
* @returns {Promise<PoolDataPoint[]>} The volume data for the pool.
*/
getVolumeData(inputs: {
timeframe: PoolGraphDataTimeframeKey;
}): Promise<PoolDataPoint[]>;
/**
* Fetches the fee data for the pool.
* @async
* @param {Object} inputs - The inputs for the method.
* @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
* @returns {Promise<PoolDataPoint[]>} The fee data for the pool.
*/
getFeeData(inputs: {
timeframe: PoolGraphDataTimeframeKey;
}): Promise<PoolDataPoint[]>;
/**
* Retrieves the volume in the last 24 hours for the pool.
* @returns A promise that resolves to the volume in the last 24 hours.
*/
getVolume24hrs: () => Promise<number>;
/**
* Fetches the deposit events for the pool.
* @async
* @param {ApiIndexerEventsBody} inputs - The inputs for the method.
* @returns {Promise<IndexerEventsWithCursor<PoolDepositEvent>>} The deposit events for the pool.
*/
getDepositEvents(inputs: ApiIndexerEventsBody): Promise<IndexerEventsWithCursor<PoolDepositEvent>>;
/**
* Fetches the withdraw events for the pool.
* @async
* @param {ApiIndexerEventsBody} inputs - The inputs for the method.
* @returns {Promise<IndexerEventsWithCursor<PoolWithdrawEvent>>} The withdraw events for the pool.
*/
getWithdrawEvents(inputs: ApiIndexerEventsBody): Promise<IndexerEventsWithCursor<PoolWithdrawEvent>>;
/**
* Fetches the trade events for the pool.
* @async
* @param {ApiIndexerEventsBody} inputs - The inputs for the method.
* @returns {Promise<IndexerEventsWithCursor<PoolTradeEvent>>} The trade events for the pool.
*/
getTradeEvents(inputs: ApiIndexerEventsBody): Promise<IndexerEventsWithCursor<PoolTradeEvent>>;
/**
* Calculates the spot price for the pool.
* @param {Object} inputs - The inputs for the method.
* @param {CoinType} inputs.coinInType - The input coin type.
* @param {CoinType} inputs.coinOutType - The output coin type.
* @param {boolean} [inputs.withFees] - Whether to include fees in the calculation.
* @returns {number} The spot price for the pool.
*/
getSpotPrice: (inputs: {
coinInType: CoinType;
coinOutType: CoinType;
withFees?: boolean;
}) => number;
/**
* Calculates the output amount for a trade.
* @param {Object} inputs - The inputs for the method.
* @param {CoinType} inputs.coinInType - The input coin type.
* @param {Balance} inputs.coinInAmount - The input coin amount.
* @param {CoinType} inputs.coinOutType - The output coin type.
* @param {boolean} [inputs.referral] - Whether the trade includes a referral.
* @returns {Balance} The output amount for the trade.
*/
getTradeAmountOut: (inputs: {
coinInType: CoinType;
coinInAmount: Balance;
coinOutType: CoinType;
referral?: boolean;
}) => Balance;
/**
* Calculates the input amount for a trade.
* @param {Object} inputs - The inputs for the method.
* @param {CoinType} inputs.coinInType - The input coin type.
* @param {Balance} inputs.coinOutAmount - The output coin amount.
* @param {CoinType} inputs.coinOutType - The output coin type.
* @param {boolean} [inputs.referral] - Whether the trade includes a referral.
* @returns {Balance} The input amount for the trade.
*/
getTradeAmountIn: (inputs: {
coinInType: CoinType;
coinOutAmount: Balance;
coinOutType: CoinType;
referral?: boolean;
}) => Balance;
/**
* Calculates the LP amount and ratio for a deposit.
* @param {Object} inputs - The inputs for the method.
* @param {CoinsToBalance} inputs.amountsIn - The input amounts.
* @param {boolean} [inputs.referral] - Whether the deposit includes a referral.
* @returns {Object} The LP amount and ratio for the deposit.
*/
getDepositLpAmountOut: (inputs: {
amountsIn: CoinsToBalance;
referral?: boolean;
}) => {
lpAmountOut: Balance;
lpRatio: number;
};
/**
* Calculates the output amounts for a withdraw.
* @param {Object} inputs - The inputs for the method.
* @param {number} inputs.lpRatio - The LP ratio.
* @param {CoinsToBalance} inputs.amountsOutDirection - The output amounts.
* @param {boolean} [inputs.referral] - Whether the withdraw includes a referral.
* @returns {CoinsToBalance} The output amounts for the withdraw.
*/
getWithdrawAmountsOut: (inputs: {
lpRatio: number;
amountsOutDirection: CoinsToBalance;
referral?: boolean;
}) => CoinsToBalance;
getWithdrawAmountsOutSimple: (inputs: {
lpCoinAmountIn: Balance;
coinTypesOut: CoinType[];
referral?: boolean;
}) => CoinsToBalance;
/**
* Calculates the output amounts for an all coin withdraw.
* @param {Object} inputs - The inputs for the method.
* @param {number} inputs.lpRatio - The LP ratio.
* @param {boolean} [inputs.referral] - Whether the withdraw includes a referral.
* @returns {CoinsToBalance} The output amounts for the all coin withdraw.
*/
getAllCoinWithdrawAmountsOut: (inputs: {
lpRatio: number;
referral?: boolean;
}) => CoinsToBalance;
/**
* Calculates the LP ratio for a multi-coin withdraw.
* @param {Object} inputs - The inputs for the method.
* @param {bigint} inputs.lpCoinAmountIn - The LP coin amount out.
* @returns {number} The LP ratio for the multi-coin withdraw.
*/
getMultiCoinWithdrawLpRatio: (inputs: {
lpCoinAmountIn: bigint;
}) => number;
/**
* Calculates the LP ratio for an all coin withdraw.
* @param {Object} inputs - The inputs for the method.
* @param {bigint} inputs.lpCoinAmountIn - The LP coin amount out.
* @returns {number} The LP ratio for the all coin withdraw.
*/
getAllCoinWithdrawLpRatio: (inputs: {
lpCoinAmountIn: bigint;
}) => number;
daoFeePercentage: () => Percentage | undefined;
daoFeeRecipient: () => SuiAddress | undefined;
private getAmountWithDAOFee;
private getAmountWithoutDAOFee;
private useProvider;
}
//# sourceMappingURL=pool.d.ts.map