Cosmos
Learn how to integrate Cosmos staking into Everstake Wallet SDK apps.
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.oneOption 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$ yarn add @everstake/wallet-sdkStep. 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)
Stake
The delegate namespace contains method used for sending transactions on delegation. The unique method to the delegate namespace is:
delegate(token, address, amount, sourceID): Delegate user tokens.
Delegate Code Example
Unstake
The undelegate namespace contains method used for sending transactions on delegation. The unique method to the undelegate namespace is:
undelegate(token, address, amount): Undelegate user tokens.
Undelegate Code Example
Redelegate
The redelegate namespace contains method used for sending transactions on delegation. The unique method to the redelegate namespace is:
redelegate(token, address, amount, validatorSrcAddress): Redelegate user tokens.
Redelegate Code Example
Withdraw Rewards
The withdrawRewards namespace contains method used for sending transactions on delegation. The unique method to the withdrawRewards namespace is:
withdrawRewards(address): Withdraw user rewards.
Withdraw Rewards Code Example
Getting Info
You can use getDelegations method to get all user delegations to use them for redelegate functionality.
The get namespace contains method used for getting info. The unique method to the get namespace is:
getDelegations(address): Gets all user delegation.
Getting Info Code Example
Response Example
Getting Undelegation Info Code Example
You can use getUndelegations method to get all user undelegations.
getUndelegations(address): Gets all user undelegations.
Response Example

