Skip to content
On this page

Getting Info Cosmos

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

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

// User wallet address.
const address = 'examplecosmos1hgmhc4hajlh8u47wmmls6ze4yrfekhs';

// Get all user delegation.
const getDelegationsResult = await Cosmos.getDelegations(address);
console.log(getDelegationsResult); // see the response below

Response Example

ts
getDelegationsResult = {
  "result": [
    {
      "delegation": {
        "delegator_address": "cosmos1hgmhc4hajlh8u47wmmls6ze4yrfekhs6ujz05e",
        "validator_address": "cosmosvaloper1ptyzewnns2kn37ewtmv6ppsvhdnmeapvtfc9y5",
        "shares": "1000.000000000000000000"
      },
      "balance": {
        "denom": "uatom",
        "amount": "1000"
      },
      "operator_address": "cosmosvaloper1ptyzewnns2kn37ewtmv6ppsvhdnmeapvtfc9y5",
      "consensus_pubkey": {
        "type": "tendermint/PubKeyEd25519",
        "value": "XiGz/D6eg3KdjaFB0uYIJwkOTW5xZcFRxJmHcQYB3zg="
      },
      "status": 3,
      "tokens": "513203840253",
      "delegator_shares": "513203840253.000000000000000000",
      "description": {
        "moniker": "WeStaking",
        "identity": "DA9C5AD3E308E426",
        "website": "https://www.westaking.io",
        "details": "Delegate your atom to us for the staking rewards. We will do our best as secure and stable validator."
      },
      "unbonding_time": "2019-09-07T12:24:58.270714195Z",
      "commission": {
        "commission_rates": {
          "rate": "0.030000000000000000",
          "max_rate": "0.200000000000000000",
          "max_change_rate": "0.010000000000000000"
        },
        "update_time": "2020-03-29T00:37:22.163935678Z"
      },
      "min_self_delegation": "1"
    },
    {
      "delegation": {
        "delegator_address": "cosmos1hgmhc4hajlh8u47wmmls6ze4yrfekhsexample",
        "validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
        "shares": "2000.000000000000000000"
      },
      "balance": {
        "denom": "uatom",
        "amount": "2000"
      },
      "operator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
      "consensus_pubkey": {
        "type": "tendermint/PubKeyEd25519",
        "value": "dhhD3I5QbtC870Il4IzML5Q2AwVDiSn9/HJ9w09Rgdg="
      },
      "status": 3,
      "tokens": "7087394678764",
      "delegator_shares": "7087394678764.000000000000000000",
      "description": {
        "moniker": "Everstake",
        "identity": "EF5AC70C00BECEDC",
        "website": "https://everstake.one",
        "details": "Reliable and experienced staking service provider from Ukraine. Visit our website for more details."
      },
      "unbonding_time": "2019-12-07T19:10:59.878559804Z",
      "commission": {
        "commission_rates": {
          "rate": "0.060000000000000000",
          "max_rate": "0.200000000000000000",
          "max_change_rate": "0.010000000000000000"
        },
        "update_time": "2022-12-31T22:25:10.09405574Z"
      },
      "min_self_delegation": "1"
    }
  ]
}