pub struct WinterWallet { /* private fields */ }Expand description
High-level view of a WinterWallet account plus local signer position.
Implementations§
Source§impl WinterWallet
impl WinterWallet
Sourcepub fn new(
id: [u8; 32],
current_root: [u8; 32],
position: SigningPosition,
) -> Self
pub fn new( id: [u8; 32], current_root: [u8; 32], position: SigningPosition, ) -> Self
Build a wallet facade from explicit account state and local position.
Sourcepub fn from_account(
account: &WinterWalletAccount,
position: SigningPosition,
) -> Self
pub fn from_account( account: &WinterWalletAccount, position: SigningPosition, ) -> Self
Build a wallet facade from a deserialized on-chain account.
Sourcepub fn current_root(&self) -> &[u8; 32]
pub fn current_root(&self) -> &[u8; 32]
Current root loaded from chain.
Sourcepub fn position(&self) -> SigningPosition
pub fn position(&self) -> SigningPosition
Local signer position expected for the next signature.
Sourcepub fn advance_plan(
&self,
new_root: &[u8; 32],
inner_instructions: &[Instruction],
) -> Result<UnsignedAdvance, Error>
pub fn advance_plan( &self, new_root: &[u8; 32], inner_instructions: &[Instruction], ) -> Result<UnsignedAdvance, Error>
Build an unsigned Advance from arbitrary inner CPI instructions.
Sourcepub fn withdraw_plan(
&self,
receiver: &Address,
lamports: u64,
new_root: &[u8; 32],
) -> Result<UnsignedAdvance, Error>
pub fn withdraw_plan( &self, receiver: &Address, lamports: u64, new_root: &[u8; 32], ) -> Result<UnsignedAdvance, Error>
Build an unsigned Advance wrapping the built-in lamport withdraw CPI.
Sourcepub fn close_plan(
&self,
receiver: &Address,
new_root: &[u8; 32],
) -> Result<UnsignedAdvance, Error>
pub fn close_plan( &self, receiver: &Address, new_root: &[u8; 32], ) -> Result<UnsignedAdvance, Error>
Build an unsigned Advance wrapping the built-in close CPI: sweeps all
lamports to receiver and tears the wallet PDA down.
Auto Trait Implementations§
impl Freeze for WinterWallet
impl RefUnwindSafe for WinterWallet
impl Send for WinterWallet
impl Sync for WinterWallet
impl Unpin for WinterWallet
impl UnsafeUnpin for WinterWallet
impl UnwindSafe for WinterWallet
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