Skip to content
On this page

Stake Aptos

The stake namespace contains method used for sending transactions on delegation. The unique method to the stake namespace is:

  • stake(token, address, amount): Stakes user tokens. For the initial stake, you need to stake a minimum of 10 APT. However, if you already have an active stake more than or equal to 10 APT, the minimum amount you can add is 0.1 Aptos.

Stake 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

// Return min amount for stake by user address
const minAmount = await Aptos.getMinAmountForStake(address);

// The amount that the user stake
const amount = 10; // must be >= minAmount

// Stake - return Raw Transaction
const txnRequest = await Aptos.stake(token, address, amount);
console.log(txnRequest); // Raw Transaction Object