Skip to main content

SyncWallet

Trait SyncWallet 

Source
pub trait SyncWallet {
    type Error: Debug + Display + Error;

    // Required methods
    fn get_birthday(&self) -> Result<BlockHeight, Self::Error>;
    fn get_sync_state(&self) -> Result<&SyncState, Self::Error>;
    fn get_sync_state_mut(&mut self) -> Result<&mut SyncState, Self::Error>;
    fn get_unified_full_viewing_keys(
        &self,
    ) -> Result<HashMap<AccountId, UnifiedFullViewingKey>, Self::Error>;
    fn add_orchard_address(
        &mut self,
        account_id: AccountId,
        address: Address,
        diversifier_index: DiversifierIndex,
    ) -> Result<(), Self::Error>;
    fn add_sapling_address(
        &mut self,
        account_id: AccountId,
        address: PaymentAddress,
        diversifier_index: DiversifierIndex,
    ) -> Result<(), Self::Error>;
    fn get_transparent_addresses(
        &self,
    ) -> Result<&BTreeMap<TransparentAddressId, String>, Self::Error>;
    fn get_transparent_addresses_mut(
        &mut self,
    ) -> Result<&mut BTreeMap<TransparentAddressId, String>, Self::Error>;

    // Provided method
    fn set_save_flag(&mut self) -> Result<(), Self::Error> { ... }
}
Expand description

Trait for interfacing wallet with the sync engine.

Required Associated Types§

Source

type Error: Debug + Display + Error

Errors associated with interfacing the sync engine with wallet data

Required Methods§

Source

fn get_birthday(&self) -> Result<BlockHeight, Self::Error>

Returns the block height wallet was created.

Source

fn get_sync_state(&self) -> Result<&SyncState, Self::Error>

Returns a reference to wallet sync state.

Source

fn get_sync_state_mut(&mut self) -> Result<&mut SyncState, Self::Error>

Returns a mutable reference to wallet sync state.

Source

fn get_unified_full_viewing_keys( &self, ) -> Result<HashMap<AccountId, UnifiedFullViewingKey>, Self::Error>

Returns all unified full viewing keys known to this wallet.

Source

fn add_orchard_address( &mut self, account_id: AccountId, address: Address, diversifier_index: DiversifierIndex, ) -> Result<(), Self::Error>

Add orchard address to wallet’s unified address list.

Source

fn add_sapling_address( &mut self, account_id: AccountId, address: PaymentAddress, diversifier_index: DiversifierIndex, ) -> Result<(), Self::Error>

Add sapling address to wallet’s unified address list.

Source

fn get_transparent_addresses( &self, ) -> Result<&BTreeMap<TransparentAddressId, String>, Self::Error>

Returns a reference to all transparent addresses known to this wallet.

Source

fn get_transparent_addresses_mut( &mut self, ) -> Result<&mut BTreeMap<TransparentAddressId, String>, Self::Error>

Returns a mutable reference to all transparent addresses known to this wallet.

Provided Methods§

Source

fn set_save_flag(&mut self) -> Result<(), Self::Error>

Aids in-memory wallets to only save when the wallet state has changed by setting a flag to mark that save is required. Persitance wallets may use the default implementation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§