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"
}
]
}
Getting Undelegation Info Code Example
You can use getUndelegations
method to get all user undelegations.
getUndelegations(address)
: Gets all user undelegations.
ts
// Import SDK
import { Cosmos } from '@everstake/wallet-sdk';
// User wallet address.
const address = 'cosmos176f4pukjdnsjmvwsngxa6re8r50rkuf7dya90m';
// Get all user delegation.
const getUndelegationsResult = await Cosmos.getUndelegations(address);
console.log(getUndelegationsResult); // see the response below
Response Example
ts
getDelegationsResult = {
"result":[
{
"delegator_address":"cosmos176f4pukjdnsjmvwsngxa6re8r50rkuf7dya90m",
"validator_address":"cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"entries":[
{
"creation_height":"22341651",
"completion_time":"2024-10-16T15:18:43.146385254Z",
"initial_balance":"100000",
"balance":"100000",
"unbonding_id":"882090",
"unbonding_on_hold_ref_count":"0"
}
]
},
{
"delegator_address":"cosmos176f4pukjdnsjmvwsngxa6re8r50rkuf7dya90m",
"validator_address":"cosmosvaloper1clpqr4nrk4khgkxj78fcwwh6dl3uw4epsluffn",
"entries":[
{
"creation_height":"22366902",
"completion_time":"2024-10-18T08:47:50.123024310Z",
"initial_balance":"10000",
"balance":"10000",
"unbonding_id":"884765",
"unbonding_on_hold_ref_count":"0"
}
]
}
]
}