0

If I have a smart contract (written in Anchor), is it possible for me to read a staking account and discover information about it: delegated stake, the delegated vote account address, the stake authority and the stake withdraw authority?

The smart contract would perform some actions based on these values, but I don't know how to do this in Anchor.

1 Answer 1

1

It looks like anchor includes a StakeAccount type at https://github.com/coral-xyz/anchor/blob/460a16171a715671f77ead5629391c0466366c08/spl/src/stake.rs#L131

Feel free to use it as a type in your program! Ie:

#[derive(Accounts)]
pub struct ProxyStake<'info> {
    #[account(mut)]
    pub stake: Account<'info, StakeAccount>,
    pub stake_program: Program<'info, Stake>,
... whatever else you need ...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.