client-aftermath-ts-sdk
Version:
Client Aftermath TypeScript SDK
143 lines • 5.39 kB
TypeScript
import { ApiCreatePoolBody, ApiPoolObjectIdForLpCoinTypeBody, ApiPublishLpCoinBody, Balance, CoinType, PoolDepositEvent, PoolWithdrawEvent, Slippage, ObjectId, PoolStats, ApiPoolsStatsBody, ApiPoolsOwnedDaoFeePoolOwnerCapsBody, PoolLpInfo, SuiAddress, ApiIndexerEventsBody, CallerConfig } from "../../types";
import { Pool } from "./pool";
import { Caller } from "../../general/utils/caller";
import { AftermathApi } from "../../general/providers";
/**
* @class Pools Provider
*
* @example
* ```
* // Create provider
* const pools = (new Aftermath("MAINNET")).Pools();
* // Call sdk
* const pool = await pools.getPool({ objectId: "0xBEEF" });
* ```
*/
export declare class Pools extends Caller {
private readonly Provider?;
/**
* An object containing various constants used in the pools module.
*/
static readonly constants: {
feePercentages: {
totalProtocol: number;
treasury: number;
insuranceFund: number;
devWallet: number;
};
referralPercentages: {
discount: number;
rebate: number;
};
bounds: {
maxCoinsInPool: number;
maxTradePercentageOfPoolBalance: number;
maxWithdrawPercentageOfPoolBalance: number;
minSwapFee: number;
maxSwapFee: number;
minWeight: number;
maxWeight: number;
minDaoFee: number;
maxDaoFee: number;
};
defaults: {
lpCoinDecimals: number;
};
};
/**
* Creates `Pools` provider to call api.
*
* @param network - The Sui network to interact with
* @returns New `Pools` instance
*/
constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
/**
* Creates new `Pool` class from queried pool object
*
* @param objectId - Object id of pool to fetch
* @returns New `Pool` instance
*/
getPool(inputs: {
objectId: ObjectId;
}): Promise<Pool>;
/**
* Creates `Pool[]` of classes from queried pool objects
*
* @param objectIds - Object ids of pools to fetch
* @returns New `Pool[]` instances
*/
getPools(inputs: {
objectIds: ObjectId[];
}): Promise<Pool[]>;
/**
* Retrieves all pools from the API and returns an array of Pool objects.
* @returns {Promise<Pool[]>} A promise that resolves to an array of Pool objects.
*/
getAllPools(): Promise<Pool[]>;
getOwnedLpCoins(inputs: {
walletAddress: SuiAddress;
}): Promise<PoolLpInfo>;
/**
* Fetches the API transaction for publishing an LP coin.
* @param inputs - The inputs for the transaction.
* @returns A promise that resolves with the API transaction.
*/
getPublishLpCoinTransaction(inputs: ApiPublishLpCoinBody): Promise<import("@mysten/sui/transactions").Transaction>;
/**
* Fetches the transaction for creating a new pool.
* @param inputs The inputs required for creating a new pool.
* @returns A Promise that resolves to the transaction data.
*/
getCreatePoolTransaction(inputs: ApiCreatePoolBody): Promise<import("@mysten/sui/transactions").Transaction>;
/**
* Returns the pool object ID for the given LP coin type.
* @param inputs - The request body containing the LP coin type.
* @returns The pool object ID.
* @throws An error if the LP coin type is invalid.
*/
getPoolObjectIdForLpCoinType: (inputs: {
lpCoinType: CoinType;
}) => Promise<(string | undefined)[]>;
getPoolObjectIdsForLpCoinTypes: (inputs: ApiPoolObjectIdForLpCoinTypeBody) => Promise<(ObjectId | undefined)[]>;
/**
* Checks if the given coin type is an LP coin type.
* @param inputs - An object containing the LP coin type to check.
* @returns A boolean indicating whether the given coin type is an LP coin type.
*/
isLpCoinType: (inputs: {
lpCoinType: CoinType;
}) => Promise<boolean>;
/**
* Retrieves the total volume in the last 24 hours.
* @returns A Promise that resolves to a number representing the total volume.
*/
getTotalVolume24hrs: () => Promise<number>;
getTVL(inputs?: {
poolIds?: ObjectId[];
}): Promise<number>;
/**
* Fetches statistics for pools.
* @async
* @returns {Promise<PoolStats[]>} The statistics for pools.
*/
getPoolsStats(inputs: ApiPoolsStatsBody): Promise<PoolStats[]>;
getOwnedDaoFeePoolOwnerCaps(inputs: ApiPoolsOwnedDaoFeePoolOwnerCapsBody): Promise<import("./poolsTypes").DaoFeePoolOwnerCapObject[]>;
getInteractionEvents(inputs: ApiIndexerEventsBody & {
walletAddress: SuiAddress;
}): Promise<import("../../types").IndexerEventsWithCursor<PoolDepositEvent | PoolWithdrawEvent>>;
static getAmountWithProtocolFees: (inputs: {
amount: Balance;
withReferral?: boolean;
}) => bigint;
static getAmountWithoutProtocolFees: (inputs: {
amount: Balance;
withReferral?: boolean;
}) => bigint;
static normalizeInvertSlippage: (slippage: Slippage) => bigint;
static displayLpCoinType: (lpCoinType: CoinType) => string;
static isPossibleLpCoinType: (inputs: {
lpCoinType: CoinType;
}) => boolean;
private useProvider;
}
//# sourceMappingURL=pools.d.ts.map