Documentation v1.0 has been released! Staking Guide, Protocols, Glossary, FAQ, and Support sections have been added.

Aptos

Learn how to connect Aptos staking via Everstake Wallet SDK API.

Getting Started

You can use two different options to implement staking for Everstake validator.

Option 1: REST API

You can use REST API to call methods which are described in Swagger with detailed examples

https://wallet-sdk-api.everstake.one

Option 2: JavaScript library

You can install and import Wallet SDK for Javascript.

Step. 1: Installing the Library

Install the npm library or yarn by copying the code below.

$ npm install @everstake/wallet-sdk

Step. 2: Import Wallet SDK

After installing the app, you can import module of needed blockchain (Ethereum, Aptos, Solana, Cosmos, Polygon are available) and use the SDK:

Import ES6

Import ES5

Step. 3: Create Auth Token

In order to access all the features of the Wallet SDK, it's necessary for you to generate an authentication token. This token will be required in all of the methods you use.

Using JS Library

Using REST API (Swagger)

Methods

Assets JS library methods

  • GetAssets(chain): The get Assets method provides information about the delegation pool.

Aptos JS library methods

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

  • reactivate(token, address, amount): Reactivates user Stake. The user can only reactivate that number of APT, which was unlocked previously. If a user possesses 15 unlocked APT, they are only able to reactivate 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 unlocking just 11 APT.

  • unlock(token, address, amount): Unlocks user tokens. The user can only unlock more than 11 APT and must have more than or equal to 11 APT in the active stake.If a user possesses 15 APT, they are only able to unlock the entire amount. This is due to the fact that the condition specifying the remaining active stake must be equal to or greater than 11 APT is not met when unlocking just 11 APT.

  • 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.

  • sendTransfer(address, recipientAddress, amount): Transfers user tokens. Using this method user can transfer APT from one wallet address to another.

  • getBalanceByAddress(address): Gets user balance.

  • getStakeBalanceByAddress(address): Gets user stake balance.

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

  • getLockupSecs(): Get validator lockup timeout in seconds

Assets API methods

  • GetAssets(chain): The GET Assets method provides information about the delegation pool.

Aptos REST API methods

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

  • unlock(token, address, amount): Unlocks user tokens. The user can only unlock more than 11 APT and must have more than or equal to 11 APT in the active stake.If a user possesses 15 APT, they are only able to unlock the entire amount. This is due to the fact that the condition specifying the remaining active stake must be equal to or greater than 11 APT is not met when unlocking just 11 APT.

  • reactivateStake(token, address, amount): Reactivates user Stake. The user can only reactivate that number of APT, which was unlocked previously. If a user possesses 15 unlocked APT, they are only able to reactivate 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 unlocking just 11 APT.

  • undelegate(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.

  • transfer(address, amount, recipientAddress): Transfers user tokens. Using this method user can transfer APT from one wallet address to another.

  • getLockupSecs(): Gets a validator lockup expired period in seconds

  • getBalanceByAddress(address): Gets user balance.

  • getStakeBalanceByAddress(address): Gets user stake balances.

  • getMinAmountForStakeByAddress(address): Gets min amount to stake.

Stake

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 11 APT. However, if you already have an active stake more than or equal to 11 APT, the minimum amount you can add is 0.1 Aptos.

Stake Code Example

Unstake

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

Reactivate

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

  • reactivate(token, address, amount): Reactivates user Stake. The user can only reactivate that number of APT, which was unlocked previously. If a user possesses 15 unlocked APT, they are only able to reactivate 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 unlocking just 11 APT.

Reactivate Stake Code Example

Unlock Stake

The unlock namespace contains method used for sending transactions on unlocking. The unique method to the unlock namespace is:

  • unlock(token, address, amount): Unlocks user tokens. The user can only unlock more than 11 APT and must have more than or equal to 11 APT in the active stake.If a user possesses 15 APT, they are only able to unlock the entire amount. This is due to the fact that the condition specifying the remaining active stake must be equal to or greater than 11 APT is not met when unlocking just 11 APT.

Unlock state Code Example

Send Transfer

The transfer namespace contains method used for sending transfer. The unique method to the transfer namespace is:

  • sendTransfer(address, recipientAddress, amount): Transfers user tokens. Using this method user can transfer APT from one wallet address to another.

Transfer Code Example

Sign Transaction

Sign Transaction Code Example

Getting Info

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.

  • getLockupSecs(): Gets a validator lockup expired period in seconds

Get Balance By Address Code Example

Get Min Stake Amount By Address Code Example

Get Stake Balance By Address Code Example

Response Example

Get a validator lockup expired period. Code Example