Aftermath Finance
  • Aftermath TypeScript SDK
    • Router
    • Liquid Staking
    • Pools
Powered by GitBook
On this page
  • Staking Positions
  • Transactions
  • Stake
  • Inspections
  • Staked Sui TVL
  • AfSui Exchange Rate

Was this helpful?

  1. Aftermath TypeScript SDK

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();

Staking Positions

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)
	},
	...
]
*/

Transactions

Stake

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
});

Inspections

Staked Sui TVL

const suiTvl = await staking.getSuiTvl();

console.log(suiTvl);
// 9_540_200_000n

AfSui Exchange Rate

// (1 Sui = x afSui)
const afSuiExchangeRate = await staking.getAfSuiExchangeRate();

console.log(afSuiExchangeRate);
// 0.890349000231
PreviousRouterNextPools

Last updated 1 year ago

Was this helpful?