client-aftermath-ts-sdk
Version:
Client Aftermath TypeScript SDK
202 lines • 9.06 kB
TypeScript
import { Transaction, TransactionObjectArgument, TransactionResult } from "@mysten/sui/transactions";
import { AftermathApi } from "../../../general/providers/aftermathApi";
import { AnyObjectType, Balance, ObjectId, PoolsAddresses, StakingAddresses, SuiAddress, LeveragedStakingAddresses, ScallopAddresses, ApiLeveragedStakePositionBody, ApiLeveragedStakePositionResponse, LeveragedAfSuiState, ApiIndexerUserEventsBody, LeveragedStakingEvent, IndexerEventsWithCursor, LeveragedStakingPerformanceDataPoint, LeveragedStakingPerformanceGraphDataTimeframeKey, LeveragedStakingPerformanceDataBody, Percentage, LeveragedAfSuiPosition } from "../../../types";
/**
* Represents the API for interacting with the Leveraged Staking module.
*/
export declare class LeveragedStakingApi {
private readonly Provider;
private readonly ScallopProviders?;
static readonly constants: {
moduleNames: {
leveragedAfSuiPosition: string;
leveragedAfSuiState: string;
interface: string;
events: string;
};
eventNames: {
leveragedStaked: string;
leveragedUnstaked: string;
leverageChanged: string;
};
};
readonly addresses: {
leveragedStaking: LeveragedStakingAddresses;
staking: StakingAddresses;
pools: PoolsAddresses;
scallop: ScallopAddresses;
};
readonly eventTypes: {
leveragedStaked: AnyObjectType;
leveragedUnstaked: AnyObjectType;
leverageChanged: AnyObjectType;
};
readonly objectTypes: {
leveragedAfSuiPosition: AnyObjectType;
};
static readonly dataTimeframesToDays: Record<LeveragedStakingPerformanceGraphDataTimeframeKey, number>;
/**
* Creates an instance of the LeveragedStakingApi class.
* @param {AftermathApi} Provider - The AftermathApi instance.
* @param {ScallopProviders} ScallopProviders - The ScallopProviders instance.
* @throws {Error} If not all required addresses have been set in AfSdk
*/
constructor(Provider: AftermathApi, ScallopProviders?: any);
/**
* Fetches the leveraged stake position for a given wallet address.
* @param inputs - The input parameters for fetching the leveraged stake position.
* @returns A promise that resolves to the leveraged stake position response.
*/
fetchLeveragedStakePosition: (inputs: ApiLeveragedStakePositionBody) => Promise<ApiLeveragedStakePositionResponse>;
/**
* Fetches the SUI market pool.
* @returns A promise that resolves to the ScallopMarketPool object representing the SUI market pool.
* @throws An error if the SUI market pool is not found.
*/
fetchSuiMarketPool: () => Promise<any>;
/**
* Fetches the LeveragedAfSuiState.
* @returns A promise that resolves to the LeveragedAfSuiState.
*/
fetchLeveragedAfSuiState: () => Promise<LeveragedAfSuiState>;
/**
* Fetches the market collateral for the AfSui market.
* @returns A promise that resolves to the ScallopMarketCollateral object.
* @throws An error if the Sui market pool is not found.
*/
fetchAfSuiMarketCollateral: () => Promise<any>;
fetchLeveragedAfSuiPosition: (inputs: {
leveragedAfSuiPositionId: ObjectId;
obligationId: ObjectId | TransactionObjectArgument;
}) => Promise<LeveragedAfSuiPosition>;
newLeveragedAfSuiPositionTx: (inputs: {
tx: Transaction;
obligationKeyId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
initiateLeverageStakeTx: (inputs: {
tx: Transaction;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
afSuiCoinId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
initiateLeverageUnstakeTx: (inputs: {
tx: Transaction;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
unstakeAmount: Balance;
}) => TransactionResult;
initiateChangeLeverageTx: (inputs: {
tx: Transaction;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
completeActionTx: (inputs: {
tx: Transaction;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
depositAfSuiCollateralTx: (inputs: {
tx: Transaction;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
afSuiCoinId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
withdrawAfSuiCollateralTx: (inputs: {
tx: Transaction;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
withdrawAmount: Balance;
}) => TransactionResult;
borrowSuiTx: (inputs: {
tx: Transaction;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
borrowAmount: Balance;
}) => TransactionResult;
repaySuiTx: (inputs: {
tx: Transaction;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
suiCoinId: ObjectId | TransactionObjectArgument;
}) => TransactionResult;
fetchBuildWithdrawAfSuiCollateralTx: (inputs: {
scallopTx: any;
leveragedActionCapId: ObjectId | TransactionObjectArgument;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
withdrawAmount: Balance;
}) => Promise<TransactionResult>;
fetchBuildOpenLeveragedStakeTx: (inputs: {
walletAddress: SuiAddress;
stakeAmount: Balance;
stakeCoinType: "sui" | "afsui";
leverage: number;
slippage: Percentage;
referrer?: SuiAddress;
isSponsoredTx?: boolean;
}) => Promise<Transaction>;
fetchBuildLeveragedStakeTx: (inputs: {
walletAddress: SuiAddress;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
stakeAmount: Balance;
stakeCoinType: "sui" | "afsui";
baseAfSuiCollateral: Balance;
totalAfSuiCollateral: Balance;
totalSuiDebt: Balance;
leverage: number;
slippage: Percentage;
referrer?: SuiAddress;
isSponsoredTx?: boolean;
}) => Promise<Transaction>;
private buildLeveragedStakeTx;
fetchBuildLeveragedUnstakeTx: (inputs: {
walletAddress: SuiAddress;
leveragedAfSuiPositionId: ObjectId;
obligationId: ObjectId | TransactionObjectArgument;
baseAfSuiCollateral: Balance;
totalAfSuiCollateral: Balance;
totalSuiDebt: Balance;
unstakeAmount: Balance;
desiredUnstakeCoinType: "sui" | "afsui";
slippage: Percentage;
referrer?: SuiAddress;
isSponsoredTx?: boolean;
}) => Promise<Transaction>;
fetchBuildChangeLeverageTx: (inputs: {
walletAddress: SuiAddress;
leveragedAfSuiPositionId: ObjectId | TransactionObjectArgument;
obligationId: ObjectId | TransactionObjectArgument;
baseAfSuiCollateral: Balance;
totalAfSuiCollateral: Balance;
totalSuiDebt: Balance;
currentLeverage: number;
newLeverage: number;
slippage: Percentage;
referrer?: SuiAddress;
isSponsoredTx?: boolean;
}) => Promise<any>;
private fetchBuildIncreaseLeverageTx;
private fetchBuildDecreaseLeverageTx;
/**
* Fetches events for a specific user.
* @param inputs - The input parameters for fetching events.
* @returns A promise that resolves to an object containing the fetched events and a cursor for pagination.
*/
fetchEventsForUser(inputs: ApiIndexerUserEventsBody): Promise<IndexerEventsWithCursor<LeveragedStakingEvent>>;
/**
* Fetches the performance data for leveraged staking.
* @param inputs - The inputs for fetching performance data.
* @returns A promise that resolves to an array of LeveragedStakingPerformanceDataPoint objects.
*/
fetchPerformanceData(inputs: LeveragedStakingPerformanceDataBody): Promise<LeveragedStakingPerformanceDataPoint[]>;
private swapOrStakeSuiToAfSui;
private updateTotalSuiDebt;
private getMarketData;
private leveragedStakedEventType;
private leveragedUnstakedEventType;
private leverageChangedEventType;
}
//# sourceMappingURL=leveragedStakingApi.d.ts.map