Deregistration
The deregisterCborHexTx
method creates unsigned transaction for deregistration stake. This method returns pledge (2 ADA) + stake (delegation) + rewards. So no need to claim rewards additionally.
typescript
import {CardanoWeb3} from "cardano-web3-js"
import {Cardano} from "@everstake/wallet-sdk-cardano";
const web3 = new CardanoWeb3({network: "preview"});
const mnemonic = '...';
const account = web3.account.fromMnemonic(mnemonic);
const blockForstProjectID = '...';
const cardano = new Cardano('preview', account.__config.paymentAddress, blockForstProjectID);
const registerAndDelegation = await cardano.deregisterCborHexTx();
const state = await account.getState();
const hash = await web3.importTx(registerAndDelegation).signWithAccount(account, state.utxos).applyAndSubmit();
console.log('tx hash', hash);