Unstake Aptos
The unstake
namespace contains method used for sending transactions on unstaking. The unique method to the unstake
namespace is:
unstake(token, address, amount)
: Unstakes user tokens. The user can only unstake that number of APT, which was unlocked previously. If a user possesses 15 unlocked APT, they are only able to unstake the entire amount. This is due to the fact that the condition specifying the remaining unlocked amount must be equal to or greater than 11 APT is not met when ustaking just 11 APT.
Unstake Code Example
ts
// Import SDK
import { Aptos } from '@everstake/wallet-sdk';
// User Public Address
const address = '0x1bae2a9343bd546e14c5e696b45be50b7d215bb627949e1e5f82470bee9bdb62';
// Token ID.
const token = process.env.TOKEN; // 3155f389-d943-4966-8e18-f159c2a6ef66
// The amount that the user unstake
const amount = 11;
// Unstake - return Raw Transaction
const txnRequest = await Aptos.unstake(token, address, amount);
console.log(txnRequest); // Raw Transaction Object