Skip to content
On this page

Undelegate Cosmos

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

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

// Token ID.
const token = process.env.TOKEN; // 3155f389-d943-4966-8e18-f159c2a6ef66

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

// The amount that the user undelegates.
const amountUndelegate = 10; // min value 0.01 (ATOM)

// Your source identificator
const sourceID = '99'

// undelegate - return transaction
const undelegate = await Cosmos.undelegate(token, address, amountUndelegate, sourceID);
console.log(undelegate); // { result: { address, msg, fee, memo } }