Unstake Ethereum
The unstake
namespace contains method used for sending transactions on unstake. The unique method to the unstake
namespace is:
unstake(address, amount, allowedInterchangeNum, source)
: You can unstake value from autocompound balance. Your ETH can be unstaked immediately if value <= pool pending balance. Also, if 'allowedInterchangeNum > 0', an instant ustake is possible. Else, you need to create a withdraw request. Please note that the execution of a withdraw request may take some time. Thesource
is a unique identifier provided by the Everstake that allows the Everstake to recognize and verify the origin of the staking transactions.unstakePending(address, amount)
: Unstakes pending amount. Your ETH will be unstaked immediately. Smart contract checks the remainder of pending balance after unstake. It should be greater or equal min stake amount (0.1 ETH for now).
Unstake Code Example
ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';
// User Public Address
const address = '0x7CB380672D37E6Cc2e1dE28616076Cf3Cexample';
const allowedInterchangeNum = 0; //from 0 to max
// The amount that the user unstakes
const amount = 1;
// The unique identifier provided by the Everstake
const source = '0';
// Unstake - return Raw Transaction
const txnRequest = await Ethereum.unstake(address, amount, allowedInterchangeNum, source);
console.log(txnRequest); // Raw Transaction
Unstake Pending Code Example
ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';
// User Public Address
const address = '0x7CB380672D37E6Cc2e1dE28616076Cf3Cexample';
// The amount that the user unstake
const amount = 1;
// Unstake - return Raw Transaction
const txnRequest = await Ethereum.unstakePending(address, amount);
console.log(txnRequest); // Raw Transaction