[][src]Trait grin_wallet_libwallet::WalletBackend

pub trait WalletBackend<'ck, C, K>: Send + Sync where
    C: NodeClient + 'ck,
    K: Keychain + 'ck, 
{ pub fn set_keychain(
        &mut self,
        k: Box<K>,
        mask: bool,
        use_test_rng: bool
    ) -> Result<Option<SecretKey>, Error>;
pub fn close(&mut self) -> Result<(), Error>;
pub fn keychain(&self, mask: Option<&SecretKey>) -> Result<K, Error>;
pub fn w2n_client(&mut self) -> &mut C;
pub fn calc_commit_for_cache(
        &mut self,
        keychain_mask: Option<&SecretKey>,
        amount: u64,
        id: &Identifier
    ) -> Result<Option<String>, Error>;
pub fn set_parent_key_id_by_name(
        &mut self,
        label: &str
    ) -> Result<(), Error>;
pub fn set_parent_key_id(&mut self, _: Identifier);
pub fn parent_key_id(&mut self) -> Identifier;
pub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a>;
pub fn get(
        &self,
        id: &Identifier,
        mmr_index: &Option<u64>
    ) -> Result<OutputData, Error>;
pub fn get_tx_log_entry(
        &self,
        uuid: &Uuid
    ) -> Result<Option<TxLogEntry>, Error>;
pub fn get_private_context(
        &mut self,
        keychain_mask: Option<&SecretKey>,
        slate_id: &[u8]
    ) -> Result<Context, Error>;
pub fn tx_log_iter<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = TxLogEntry> + 'a>;
pub fn acct_path_iter<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = AcctPathMapping> + 'a>;
pub fn get_acct_path(
        &self,
        label: String
    ) -> Result<Option<AcctPathMapping>, Error>;
pub fn store_tx(&self, uuid: &str, tx: &Transaction) -> Result<(), Error>;
pub fn get_stored_tx(
        &self,
        uuid: &str
    ) -> Result<Option<Transaction>, Error>;
pub fn batch<'a>(
        &'a mut self,
        keychain_mask: Option<&SecretKey>
    ) -> Result<Box<dyn WalletOutputBatch<K> + 'a>, Error>;
pub fn batch_no_mask<'a>(
        &'a mut self
    ) -> Result<Box<dyn WalletOutputBatch<K> + 'a>, Error>;
pub fn current_child_index(
        &mut self,
        parent_key_id: &Identifier
    ) -> Result<u32, Error>;
pub fn next_child(
        &mut self,
        keychain_mask: Option<&SecretKey>
    ) -> Result<Identifier, Error>;
pub fn last_confirmed_height(&mut self) -> Result<u64, Error>;
pub fn last_scanned_block(&mut self) -> Result<ScannedBlockInfo, Error>;
pub fn init_status(&mut self) -> Result<WalletInitStatus, Error>; }

TODO: Wallets should implement this backend for their storage. All functions here expect that the wallet instance has instantiated itself or stored whatever credentials it needs

Required methods

pub fn set_keychain(
    &mut self,
    k: Box<K>,
    mask: bool,
    use_test_rng: bool
) -> Result<Option<SecretKey>, Error>
[src]

Set the keychain, which should already be initialized Optionally return a token value used to XOR the stored key value

pub fn close(&mut self) -> Result<(), Error>[src]

Close wallet and remove any stored credentials (TBD)

pub fn keychain(&self, mask: Option<&SecretKey>) -> Result<K, Error>[src]

Return the keychain being used. Ensure a cloned copy so it will be dropped and zeroized by the caller Can optionally take a mask value

pub fn w2n_client(&mut self) -> &mut C[src]

Return the client being used to communicate with the node

pub fn calc_commit_for_cache(
    &mut self,
    keychain_mask: Option<&SecretKey>,
    amount: u64,
    id: &Identifier
) -> Result<Option<String>, Error>
[src]

return the commit for caching if allowed, none otherwise

pub fn set_parent_key_id_by_name(&mut self, label: &str) -> Result<(), Error>[src]

Set parent key id by stored account name

pub fn set_parent_key_id(&mut self, _: Identifier)[src]

The BIP32 path of the parent path to use for all output-related functions, (essentially 'accounts' within a wallet.

pub fn parent_key_id(&mut self) -> Identifier[src]

return the parent path

pub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a>[src]

Iterate over all output data stored by the backend

pub fn get(
    &self,
    id: &Identifier,
    mmr_index: &Option<u64>
) -> Result<OutputData, Error>
[src]

Get output data by id

pub fn get_tx_log_entry(&self, uuid: &Uuid) -> Result<Option<TxLogEntry>, Error>[src]

Get an (Optional) tx log entry by uuid

pub fn get_private_context(
    &mut self,
    keychain_mask: Option<&SecretKey>,
    slate_id: &[u8]
) -> Result<Context, Error>
[src]

Retrieves the private context associated with a given slate id

pub fn tx_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = TxLogEntry> + 'a>[src]

Iterate over all output data stored by the backend

pub fn acct_path_iter<'a>(
    &'a self
) -> Box<dyn Iterator<Item = AcctPathMapping> + 'a>
[src]

Iterate over all stored account paths

pub fn get_acct_path(
    &self,
    label: String
) -> Result<Option<AcctPathMapping>, Error>
[src]

Gets an account path for a given label

pub fn store_tx(&self, uuid: &str, tx: &Transaction) -> Result<(), Error>[src]

Stores a transaction

pub fn get_stored_tx(&self, uuid: &str) -> Result<Option<Transaction>, Error>[src]

Retrieves a stored transaction from a TxLogEntry

pub fn batch<'a>(
    &'a mut self,
    keychain_mask: Option<&SecretKey>
) -> Result<Box<dyn WalletOutputBatch<K> + 'a>, Error>
[src]

Create a new write batch to update or remove output data

pub fn batch_no_mask<'a>(
    &'a mut self
) -> Result<Box<dyn WalletOutputBatch<K> + 'a>, Error>
[src]

Batch for use when keychain isn't available or required

pub fn current_child_index(
    &mut self,
    parent_key_id: &Identifier
) -> Result<u32, Error>
[src]

Return the current child Index

pub fn next_child(
    &mut self,
    keychain_mask: Option<&SecretKey>
) -> Result<Identifier, Error>
[src]

Next child ID when we want to create a new output, based on current parent

pub fn last_confirmed_height(&mut self) -> Result<u64, Error>[src]

last verified height of outputs directly descending from the given parent key

pub fn last_scanned_block(&mut self) -> Result<ScannedBlockInfo, Error>[src]

last block scanned during scan or restore

pub fn init_status(&mut self) -> Result<WalletInitStatus, Error>[src]

Flag whether the wallet needs a full UTXO scan on next update attempt

Loading content...

Implementors

Loading content...