---
# System prepended metadata

title: Deposit dETH and rage quit

---

```
const main = async () => {
    
    // Change network to mainnet
    const provider = new ethers.providers.AlchemyProvider("goerli", ALCHEMY_API_KEY);
    const signer = new ethers.Wallet(PRIV_KEY_2, provider);

    // Initialise the SDK
    const sdk = new StakehouseSDK(signer);

    // Amount of dETH needed to deposit
    let dETHDepositAmount = "AMOUNT_OF_DETH_IN_WEI";

    const dETH = (await sdk.contractInstance).dETHContract();

    // Allow rage quit assistant to transfer dETH from user's wallet
    const allowanceTx = await dETH.approve(
        rageQuitAssistantAddress,
        dETHDepositAmount
    );
    console.log("allowanceTx: ", allowanceTx);

    // Deposit dETH into the rage quit assistant
    const depositDETHTx = await sdk.wizard.depositDETHInRageQuitAssistant(
        rageQuitAssistantAddress,
        dETHDepositAmount
    );
    console.log("depositDETHTx: ", depositDETHTx);

    // Fetch latest finalised report of the validator
    const finalisedReport = await sdk.balanceReport.getFinalisedEpochReport(
        BEACON_NODE_URL,
        blsPublicKey
    );
    console.log("finalisedReport: ", finalisedReport);

    // Verify the finalised epoch report
    const authenticatedReport = await sdk.balanceReport.authenticateReport(
        BEACON_NODE_URL,
        finalisedReport
    );
    console.log("finalisedReport: ", finalisedReport);

    // This is the amount of ETH needed to top up for the validator to exit.
    // This will not be 0 in case the validator was leaking.
    const ethValue = await sdk.utils.currentSlashedAmountOfSLOTForKnot(blsPublicKey);

    // Rage quit the validator
    // This will transfer ETH from user's wallet if ethValue is non-zero
    const rageQuitTx = await sdk.wizard.rageQuit(
        liquidStakingManagerAddress,
        blsPublicKey,
        authenticatedReport,
        ethValue
    );
    console.log("rageQuitTx: ", rageQuitTx);
}

main();
```