Skip to content
On this page

Cancel Unstake BGT

The cancel unstake method creates unsigned transaction for canceling drop from the queue (unstake). It can be canceled if address has not finished unstakes

  • cancelUnstake(address, amount): cancel drop (unstake) specific amount of boost from the queue
js
import {Berrachain} from '@everstake/wallet-sdk-berrachain';
import Web3 from 'web3';

const rpc = 'https://some-berrachain-rpc.com';
const privateKey = "1a...02";

const web3 = new Web3(rpc);

// your account
const account = web3.eth.accounts.privateKeyToAccount(privateKey);

// create instance of Berrachain class
const berrachain = new Berrachain('testnet', rpc);

// drop (unstake) amount
const amount = '0.00000001';

const txDetails = await bera.cancelUnstake(account.address, amount);
const nonce = await web3.eth.getTransactionCount(account.address);

const tx = { ...txDetails, nonce };
const signedTx = await web3.eth.accounts.signTransaction(tx, privateKey);
if (signedTx.rawTransaction) {
    const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
    console.log("Transaction receipt:", receipt);
}