cow-settlement-client 0.5.3

Off-chain client helpers for building CoW Protocol Solana settlement program instructions.
Documentation
//! Builder for the `TransferAuthority` instruction.

use cow_settlement_interface::{pda::state::find_state_pda, Instruction, Pubkey, Role};

/// Transfers `role` to `new_authority` in a single step. Signed by `signer`,
/// which must be the manager or the current holder of `role`.
pub struct TransferAuthority {
    pub program_id: Pubkey,
    pub signer: Pubkey,
    pub role: Role,
    pub new_authority: Pubkey,
}

impl From<TransferAuthority> for Instruction {
    fn from(builder: TransferAuthority) -> Self {
        cow_settlement_interface::instruction::transfer_authority::TransferAuthority {
            program_id: builder.program_id,
            signer: builder.signer,
            state_pda: find_state_pda(&builder.program_id).0,
            role: builder.role,
            new_authority: builder.new_authority,
        }
        .into()
    }
}