Skip to content
On this page

Getting Info Aptos

The get namespace contains method used for getting info. The unique method to the get namespace is:

  • getBalanceByAddress(address): Gets user balance.
  • getStakeBalanceByAddress(address): Gets user stake balance.
  • getMinAmountForStake(address): Gets user min amount for stake.

Get Balance By Address Code Example

ts
// Import SDK
import { Aptos } from '@everstake/wallet-sdk';

// User public address.
const address = '0xc4c25dea791fd3e2551507e9b0524565c86da1833ade5ba61eb9967ca71fc138';

// Return user balance in APT.
const getDelegationsResult = await Aptos.getBalanceByAddress(address);
console.log(getDelegationsResult); // 2.18 (Amount in APT)

Get Balance By Address Code Example

ts
// Import SDK
import { Aptos } from '@everstake/wallet-sdk';

// User public address.
const address = '0xc4c25dea791fd3e2551507e9b0524565c86da1833ade5ba61eb9967ca71fc138';

// Return min amount for stake in APT.
const getMinAmountForStakeResult = await Aptos.getMinAmountForStake(address);
console.log(getMinAmountForStakeResult); // 10 | 0.1 (Amount in APT)

Get Stake Balance By Address Code Example

ts
// Import SDK
import { Aptos } from '@everstake/wallet-sdk';

// User public address.
const address = '0xc4c25dea791fd3e2551507e9b0524565c86da1833ade5ba61eb9967ca71fc138';

// Return user stake balance in APT.
const getStakeBalanceByAddressResult = await Aptos.getStakeBalanceByAddress(address);
console.log(getStakeBalanceByAddressResult); // see the response below

Response Example

ts
stake_balance = {
    // after STAKE, one of `active` + `pending_active` stake
    "active": 10,
    // one of `inactive` stake FOR each past observed lockup cycle (OLC) on the stake pool
    "inactive": 0,
    // after UNLOCK, one of `pending_inactive` stake scheduled during this ongoing OLC
    "pending_inactive": 20
};