[Staking ADO] Allow user to query current delegation info for defined validator
Closed this issue · 0 comments
crnbarr93 commented
Description
Upon staking a user should be able to query how much they have staked with a given validator and how much rewards they have accumulated.
Implementation
The query message for this is rather simple:
#[andr_query]
#[cw_serde]
pub enum QueryMsg {
StakedTokens {
#[returns(Option<Delegation>)]
pub validator: Option<Addr>
}
}
As for fetching staked tokens this can be done via this method. If no validator
field is provided, use DEFAULT_VALIDATOR
from state.
Acceptance Criteria
- A query to see delegations for a given validator
- Unit testing