Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/authorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> AuthorizeFreeAccounts<S> {
authority_getter: fn(&StakeOrInitializedStakeAccount<&'a S>) -> Pubkey,
) -> Result<AuthorizeFreeKeys, ProgramError> {
let Self { stake } = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
let authority = authority_getter(&s);
Ok(AuthorizeFreeKeys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> AuthorizeCheckedFreeAccount
stake,
new_authority,
} = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
Ok(AuthorizeCheckedFreeKeys {
stake: *stake.pubkey(),
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/deactivate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> DeactivateFreeAccounts<S> {

pub fn resolve_to_free_keys(&self) -> Result<DeactivateFreeKeys, ProgramError> {
let Self { stake } = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
let stake_authority = s.stake_meta_authorized_staker();
Ok(DeactivateFreeKeys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> DeactivateDelinquentFreeAcc
stake,
reference_vote,
} = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake()?;
Ok(DeactivateDelinquentKeys {
stake: *stake.pubkey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> DelegateStakeFreeAccounts<S

pub fn resolve_to_free_keys(&self) -> Result<DelegateStakeFreeKeys, ProgramError> {
let Self { stake, vote } = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
Ok(DelegateStakeFreeKeys {
stake: *stake.pubkey(),
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use stake_program_interface::MergeKeys;
use crate::ReadonlyStakeAccount;

fn read_stake_authority_checked<T: ReadonlyAccountData>(stake: T) -> Result<Pubkey, ProgramError> {
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
Ok(s.stake_meta_authorized_staker())
}
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/redelegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> RedelegateFreeAccounts<S> {
uninitialized_stake,
vote,
} = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
Ok(RedelegateFreeKeys {
stake: *stake.pubkey(),
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/set_lockup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> SetLockupFreeAccounts<S> {
getter: fn(&StakeOrInitializedStakeAccount<&'a S>) -> Pubkey,
) -> Result<Pubkey, ProgramError> {
let Self { stake } = self;
let s = ReadonlyStakeAccount(stake);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(stake)?;
let s = s.try_into_stake_or_initialized()?;
Ok(getter(&s))
}
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pub struct SplitFreeAccounts<S> {
impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> SplitFreeAccounts<S> {
pub fn resolve(&self) -> Result<SplitKeys, ProgramError> {
let Self { from, to } = self;
let s = ReadonlyStakeAccount(from);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(from)?;
let s = s.try_into_stake_or_initialized()?;
Ok(SplitKeys {
from: *from.pubkey(),
Expand Down
3 changes: 1 addition & 2 deletions libs/sanctum-stake-lib/src/account_resolvers/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ impl<S: ReadonlyAccountData + ReadonlyAccountPubkey> WithdrawFreeAccounts<S> {

pub fn resolve_to_free_keys(&self) -> Result<WithdrawFreeKeys, ProgramError> {
let Self { from, to } = self;
let s = ReadonlyStakeAccount(from);
let s = s.try_into_valid()?;
let s = ReadonlyStakeAccount::try_new(from)?;
let s = s.try_into_stake_or_initialized()?;
let withdraw_authority = s.stake_meta_authorized_withdrawer();
Ok(WithdrawFreeKeys {
Expand Down
Loading