Liquid Staking
Stake Sui and receive AfSui to earn a reliable yield, and hold the largest staking derivative on Sui.
const staking = new Aftermath("TESTNET").Staking();
const stakingPositions = await staking.getStakingPositions({
walletAddress: "0x..",
});
console.log(stakingPositions);
/*
[
// stake position
{
state: "SUCCESS",
suiWrapperId: "0x..",
staker: "0x..",
validatorAddress: "0x..",
epoch: 728n,
suiStakeAmount: 1_000_000_000n, // 1 Sui
txnDigest: "0x..",
// optional
afSuiMintAmount: 1_000_000_000n, // 1 AfSui
timestamp: 1683834217840, // unix time (milliseconds)
},
// unstake position
{
state: "REQUEST",
afSuiWrapperId: "0x..",
staker: "0x..",
epoch: 728n,
suiUnstakeAmount: 1_000_000_000n, // 1 Sui
afSuiAmountGiven: 1_000_000_000n, // 1 AfSui
txnDigest: "0x..",
// optional
timestamp: 1683834217840, // unix time (milliseconds)
},
...
]
*/
const tx = await staking.getStakeTransaction({
walletAddress: "0x..",
suiStakeAmount: 1_000_000_000n, // 1 Sui
validatorAddress: "0x..",
});
const tx = await staking.getUnstakeTransaction({
walletAddress: "0x..",
afSuiUnstakeAmount: 1_000_000_000n, // 1 AfSui
});
const suiTvl = await staking.getSuiTvl();
console.log(suiTvl);
// 9_540_200_000n
// (1 Sui = x afSui)
const afSuiExchangeRate = await staking.getAfSuiExchangeRate();
console.log(afSuiExchangeRate);
// 0.890349000231
Last modified 22d ago