hm-aftermath-ts-sdk
Version:
Aftermath TypeScript SDK
125 lines • 5.86 kB
TypeScript
import { ApiStakeBody, ApiUnstakeBody, SuiNetwork, ApiStakingPositionsBody, StakingPosition, Balance, ValidatorConfigObject, ApiStakeStakedSuiBody, ApiDelegatedStakesBody, SuiDelegatedStake, ApiValidatorOperationCapsBody, ValidatorOperationCapObject, ApiUpdateValidatorFeeBody, Percentage, StakedSuiVaultStateObject, SuiAddress } from "../../types";
import { Caller } from "../../general/utils/caller";
import { SuiValidatorSummary, ValidatorsApy } from "@mysten/sui/client";
import { AftermathApi } from "../../general/providers";
/**
* The Staking class provides an interface for interacting with the Staking contract.
*/
export declare class Staking extends Caller {
readonly network?: SuiNetwork | undefined;
private readonly Provider?;
/**
* Constants related to staking.
*/
static readonly constants: {
fees: {
protocolUnstake: number;
defaultValidator: number;
maxValidator: number;
};
bounds: {
minStake: bigint;
minUnstake: bigint;
/**
* Max fee percentage that third parties can charge on staking/unstaking transactions
*/
maxExternalFeePercentage: number;
};
defaultValidatorFee: number;
};
/**
* Creates a new instance of the Staking class.
* @param network - The network to use for interacting with the Staking contract.
*/
constructor(network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
/**
* Fetches the list of active validators.
* @returns A Promise that resolves to an array of `SuiValidatorSummary` objects.
*/
getActiveValidators(): Promise<SuiValidatorSummary[]>;
/**
* Fetches the APYs for all validators.
* @returns A Promise that resolves to a `ValidatorsApy` object.
*/
getValidatorApys(): Promise<ValidatorsApy>;
/**
* Fetches the configuration for all validators.
* @returns A Promise that resolves to an array of `ValidatorConfigObject` objects.
*/
getValidatorConfigs(): Promise<ValidatorConfigObject[]>;
/**
* Fetches the staking positions for a given account.
* @param inputs - An object containing the account address and optional pagination parameters.
* @returns A Promise that resolves to an array of `StakingPosition` objects.
*/
getStakingPositions(inputs: ApiStakingPositionsBody): Promise<StakingPosition[]>;
/**
* Fetches the delegated stakes for a given validator.
* @param inputs - An object containing the validator address and optional pagination parameters.
* @returns A Promise that resolves to an array of `SuiDelegatedStake` objects.
*/
getDelegatedStakes(inputs: ApiDelegatedStakesBody): Promise<SuiDelegatedStake[]>;
/**
* Fetches the operation caps for a given validator.
* @param inputs - An object containing the validator address and optional pagination parameters.
* @returns A Promise that resolves to an array of `ValidatorOperationCapObject` objects.
*/
getValidatorOperationCaps(inputs: ApiValidatorOperationCapsBody): Promise<ValidatorOperationCapObject[]>;
/**
* Fetches the transaction object for staking SUI.
* @param inputs - An object containing the staker address and the amount of SUI to stake.
* @returns A Promise that resolves to a transaction object.
*/
getStakeTransaction(inputs: ApiStakeBody): Promise<import("@mysten/sui/transactions").Transaction>;
/**
* Fetches the transaction object for unstaking SUI.
* @param inputs - An object containing the staker address and the amount of SUI to unstake.
* @returns A Promise that resolves to a transaction object.
*/
getUnstakeTransaction(inputs: ApiUnstakeBody): Promise<import("@mysten/sui/transactions").Transaction>;
/**
* Fetches the transaction object for staking stakedSUI.
* @param inputs - An object containing the staker address and the amount of stakedSUI to stake.
* @returns A Promise that resolves to a transaction object.
*/
getStakeStakedSuiTransaction(inputs: ApiStakeStakedSuiBody): Promise<import("@mysten/sui/transactions").Transaction>;
/**
* Fetches the transaction object for updating a validator's fee.
* @param inputs - An object containing the validator address and the new fee percentage.
* @returns A Promise that resolves to a transaction object.
*/
getUpdateValidatorFeeTransaction(inputs: ApiUpdateValidatorFeeBody): Promise<import("@mysten/sui/transactions").Transaction>;
getCrankAfSuiTransaction(inputs: {
walletAddress: SuiAddress;
}): import("@mysten/sui/transactions").Transaction;
/**
* Fetches the total value locked in SUI.
* @returns A Promise that resolves to a `Balance` object.
*/
getSuiTvl(): Promise<Balance>;
/**
* Fetches the exchange rate between afSUI and SUI.
* @returns A Promise that resolves to a number.
*/
getAfSuiToSuiExchangeRate(): Promise<number>;
/**
* Fetches the state of the stakedSUI vault.
* @returns A Promise that resolves to a `StakedSuiVaultStateObject` object.
*/
getStakedSuiVaultState(): Promise<StakedSuiVaultStateObject>;
/**
* Fetches the current APY for staking SUI.
* @returns A Promise that resolves to a number.
*/
getApy(): Promise<number>;
/**
* Calculates the atomic unstake fee for a given stakedSUI vault state.
* @param inputs - An object containing the stakedSUI vault state.
* @returns A `Percentage` object representing the atomic unstake fee.
*/
static calcAtomicUnstakeFee(inputs: {
stakedSuiVaultState: StakedSuiVaultStateObject;
}): Percentage;
private useProvider;
}
//# sourceMappingURL=staking.d.ts.map