Skip to main content

WinterWallet

Struct WinterWallet 

Source
pub struct WinterWallet { /* private fields */ }
Expand description

High-level view of a WinterWallet account plus local signer position.

Implementations§

Source§

impl WinterWallet

Source

pub fn new( id: [u8; 32], current_root: [u8; 32], position: SigningPosition, ) -> Self

Build a wallet facade from explicit account state and local position.

Source

pub fn from_account( account: &WinterWalletAccount, position: SigningPosition, ) -> Self

Build a wallet facade from a deserialized on-chain account.

Source

pub fn id(&self) -> &[u8; 32]

Wallet ID committed by the account.

Source

pub fn pda(&self) -> &Address

Wallet PDA.

Source

pub fn current_root(&self) -> &[u8; 32]

Current root loaded from chain.

Source

pub fn position(&self) -> SigningPosition

Local signer position expected for the next signature.

Source

pub fn advance_plan( &self, new_root: &[u8; 32], inner_instructions: &[Instruction], ) -> Result<UnsignedAdvance, Error>

Build an unsigned Advance from arbitrary inner CPI instructions.

Source

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.

Source

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.

Source

pub fn transfer_plan( &self, source_token_account: &Address, destination_token_account: &Address, token_program: &Address, amount: u64, new_root: &[u8; 32], ) -> Result<UnsignedAdvance, Error>

Build an unsigned Advance wrapping an SPL Token transfer CPI.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.