pub struct AdvancePlan { /* private fields */ }Expand description
Fully assembled but unsigned Advance instruction plan.
A plan owns the encoded CPI payload and passthrough account order, so callers cannot accidentally sign one account order and submit another.
Implementations§
Source§impl AdvancePlan
impl AdvancePlan
Sourcepub fn new(
wallet_pda: &Address,
new_root: &[u8; 32],
inner_instructions: &[Instruction],
) -> Result<Self, Error>
pub fn new( wallet_pda: &Address, new_root: &[u8; 32], inner_instructions: &[Instruction], ) -> Result<Self, Error>
Build an Advance plan from inner CPI instructions.
Sourcepub fn wallet_pda(&self) -> &Address
pub fn wallet_pda(&self) -> &Address
Wallet PDA this plan targets.
Sourcepub fn withdraw(
wallet_pda: &Address,
receiver: &Address,
lamports: u64,
new_root: &[u8; 32],
) -> Result<Self, Error>
pub fn withdraw( wallet_pda: &Address, receiver: &Address, lamports: u64, new_root: &[u8; 32], ) -> Result<Self, Error>
Build a plan for the built-in lamport withdraw CPI.
Sourcepub fn close(
wallet_pda: &Address,
receiver: &Address,
new_root: &[u8; 32],
) -> Result<Self, Error>
pub fn close( wallet_pda: &Address, receiver: &Address, new_root: &[u8; 32], ) -> Result<Self, Error>
Build a plan for the built-in close CPI, sweeping all lamports from the
wallet PDA to receiver and tearing the account down.
Sourcepub fn passthrough_accounts(&self) -> &[AccountMeta]
pub fn passthrough_accounts(&self) -> &[AccountMeta]
Passthrough accounts in the exact order expected by the on-chain handler.
Sourcepub fn account_addresses(&self) -> &[[u8; 32]]
pub fn account_addresses(&self) -> &[[u8; 32]]
Account addresses included in the Advance preimage.
Sourcepub fn preimage<'a>(
&'a self,
wallet_id: &'a [u8; 32],
current_root: &'a [u8; 32],
) -> Vec<&'a [u8]>
pub fn preimage<'a>( &'a self, wallet_id: &'a [u8; 32], current_root: &'a [u8; 32], ) -> Vec<&'a [u8]>
Build the preimage parts to sign for this plan.
Sourcepub fn instruction(&self, signature_bytes: &[u8; 768]) -> Instruction
pub fn instruction(&self, signature_bytes: &[u8; 768]) -> Instruction
Convert the plan into a signed Advance instruction.
Auto Trait Implementations§
impl Freeze for AdvancePlan
impl RefUnwindSafe for AdvancePlan
impl Send for AdvancePlan
impl Sync for AdvancePlan
impl Unpin for AdvancePlan
impl UnsafeUnpin for AdvancePlan
impl UnwindSafe for AdvancePlan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more