Trait Account

Source
pub trait Account {
    type AccountId: Copy;

    // Required methods
    fn id(&self) -> Self::AccountId;
    fn name(&self) -> Option<&str>;
    fn source(&self) -> &AccountSource;
    fn ufvk(&self) -> Option<&UnifiedFullViewingKey>;
    fn uivk(&self) -> UnifiedIncomingViewingKey;

    // Provided method
    fn purpose(&self) -> AccountPurpose { ... }
}
Expand description

A set of capabilities that a client account must provide.

Required Associated Types§

Required Methods§

Source

fn id(&self) -> Self::AccountId

Returns the unique identifier for the account.

Source

fn name(&self) -> Option<&str>

Returns the human-readable name for the account, if any has been configured.

Source

fn source(&self) -> &AccountSource

Returns whether this account is derived or imported, and the derivation parameters if applicable.

Source

fn ufvk(&self) -> Option<&UnifiedFullViewingKey>

Returns the UFVK that the wallet backend has stored for the account, if any.

Accounts for which this returns None cannot be used in wallet contexts, because they are unable to maintain an accurate balance.

Source

fn uivk(&self) -> UnifiedIncomingViewingKey

Returns the UIVK that the wallet backend has stored for the account.

All accounts are required to have at least an incoming viewing key. This gives no indication about whether an account can be used in a wallet context; for that, use Account::ufvk.

Provided Methods§

Source

fn purpose(&self) -> AccountPurpose

Returns whether the account is a spending account or a view-only account.

Implementations on Foreign Types§

Source§

impl<A: Copy> Account for (A, UnifiedFullViewingKey)

Available on crate feature test-dependencies only.
Source§

impl<A: Copy> Account for (A, UnifiedIncomingViewingKey)

Available on crate feature test-dependencies only.

Implementors§

Source§

impl<A: Account> Account for TestAccount<A>

Available on crate feature test-dependencies only.