Skip to content
On this page

Withdraw Rewards

The withdrawRewardsCborHexTx method creates unsigned transaction for withdraw rewards. Cardano has auto compound strategy, so it means no need claim rewards to increase APR. But if rewards should be spent need to call withdraw or deregister method.

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 withdrawTx = await cardano.withdrawRewardsCborHexTx();
const state = await account.getState();
const hash = await web3.importTx(withdrawTx).signWithAccount(account, state.utxos).applyAndSubmit();
console.log('tx hash', hash);