Skip to Content
Evolution SDK
Staking

Rewards Withdrawal

Withdraw accumulated staking rewards

Rewards Withdrawal

Staking rewards accumulate each epoch and must be explicitly withdrawn to your wallet. The withdraw operation claims rewards from a registered stake credential.

Basic Withdrawal

import { , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

// Get your stake credential and query rewards
const  = await .()
const  = .!
const  = await .()
.("Available rewards:", ., "lovelace")

// Withdraw all rewards
const  = await 
  .()
  .({
    ,
    : .
  })
  .()

const  = await .()
await .()

Zero-Amount Withdrawal (Validator Trigger)

Use amount: 0n to trigger a stake validator without actually withdrawing rewards. This is the coordinator pattern used by some DeFi protocols:

import { , , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

declare const : . // script-controlled stake credential
declare const : any // compiled Plutus staking script (from Aiken build or Blueprint codegen)

// Trigger the stake validator with zero withdrawal
const  = await 
  .()
  .({
    : ,
    : 0n, // Don't actually withdraw — just trigger the validator
    : .(0n, []),
    : "coordinator-trigger"
  })
  .({ :  })
  .()

const  = await .()
await .()

This pattern is useful for validators that need to run stake-level checks as part of a larger transaction.

Script-Controlled Withdrawal

import { , , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

declare const : . // script-controlled stake credential
declare const : any // compiled Plutus staking script (from Aiken build or Blueprint codegen)
declare const : bigint // from client.getWalletDelegation().rewards

const  = await 
  .()
  .({
    : ,
    : ,
    : .(0n, [])
  })
  .({ :  })
  .()

const  = await .()
await .()

Next Steps

On this page