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 = ({
: "preprod",
: { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
: { : "seed", : ..!, : 0 }
})
declare const : .
// Query current rewards via wallet
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 = ({
: "preprod",
: { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
: { : "seed", : ..!, : 0 }
})
declare const : .
declare const : any
// 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 = ({
: "preprod",
: { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
: { : "seed", : ..!, : 0 }
})
declare const : .
declare const : any
declare const : bigint
const = await
.()
.({
: ,
: ,
: .(0n, [])
})
.({ : })
.()
const = await .()
await .()Next Steps
- Deregistration — Withdraw before deregistering
- Delegation — Change pool delegation
- Querying Delegation — Check reward balance