pub trait WalletLCProvider<'a, C, K>: Send + Syncwhere
C: NodeClient + 'a,
K: Keychain + 'a,{
Show 13 methods
// Required methods
fn set_top_level_directory(&mut self, dir: &str) -> Result<(), Error>;
fn get_top_level_directory(&self) -> Result<String, Error>;
fn create_config(
&self,
chain_type: &ChainTypes,
file_name: &str,
wallet_config: Option<WalletConfig>,
logging_config: Option<LoggingConfig>,
tor_config: Option<TorConfig>
) -> Result<(), Error>;
fn create_wallet(
&mut self,
name: Option<&str>,
mnemonic: Option<ZeroingString>,
mnemonic_length: usize,
password: ZeroingString,
test_mode: bool
) -> Result<(), Error>;
fn open_wallet(
&mut self,
name: Option<&str>,
password: ZeroingString,
create_mask: bool,
use_test_rng: bool
) -> Result<Option<SecretKey>, Error>;
fn close_wallet(&mut self, name: Option<&str>) -> Result<(), Error>;
fn wallet_exists(&self, name: Option<&str>) -> Result<bool, Error>;
fn get_mnemonic(
&self,
name: Option<&str>,
password: ZeroingString
) -> Result<ZeroingString, Error>;
fn validate_mnemonic(&self, mnemonic: ZeroingString) -> Result<(), Error>;
fn recover_from_mnemonic(
&self,
mnemonic: ZeroingString,
password: ZeroingString
) -> Result<(), Error>;
fn change_password(
&self,
name: Option<&str>,
old: ZeroingString,
new: ZeroingString
) -> Result<(), Error>;
fn delete_wallet(&self, name: Option<&str>) -> Result<(), Error>;
fn wallet_inst(
&mut self
) -> Result<&mut Box<dyn WalletBackend<'a, C, K> + 'a>, Error>;
}
Expand description
Trait for a provider of wallet lifecycle methods
Required Methods§
sourcefn set_top_level_directory(&mut self, dir: &str) -> Result<(), Error>
fn set_top_level_directory(&mut self, dir: &str) -> Result<(), Error>
Sets the top level system wallet directory default is assumed to be ~/.grin/main/wallet_data (or testnet equivalent)
sourcefn get_top_level_directory(&self) -> Result<String, Error>
fn get_top_level_directory(&self) -> Result<String, Error>
Sets the top level system wallet directory default is assumed to be ~/.grin/main/wallet_data (or testnet equivalent)
sourcefn create_config(
&self,
chain_type: &ChainTypes,
file_name: &str,
wallet_config: Option<WalletConfig>,
logging_config: Option<LoggingConfig>,
tor_config: Option<TorConfig>
) -> Result<(), Error>
fn create_config( &self, chain_type: &ChainTypes, file_name: &str, wallet_config: Option<WalletConfig>, logging_config: Option<LoggingConfig>, tor_config: Option<TorConfig> ) -> Result<(), Error>
Output a grin-wallet.toml file into the current top-level system wallet directory
sourcefn create_wallet(
&mut self,
name: Option<&str>,
mnemonic: Option<ZeroingString>,
mnemonic_length: usize,
password: ZeroingString,
test_mode: bool
) -> Result<(), Error>
fn create_wallet( &mut self, name: Option<&str>, mnemonic: Option<ZeroingString>, mnemonic_length: usize, password: ZeroingString, test_mode: bool ) -> Result<(), Error>
sourcefn open_wallet(
&mut self,
name: Option<&str>,
password: ZeroingString,
create_mask: bool,
use_test_rng: bool
) -> Result<Option<SecretKey>, Error>
fn open_wallet( &mut self, name: Option<&str>, password: ZeroingString, create_mask: bool, use_test_rng: bool ) -> Result<Option<SecretKey>, Error>
sourcefn wallet_exists(&self, name: Option<&str>) -> Result<bool, Error>
fn wallet_exists(&self, name: Option<&str>) -> Result<bool, Error>
whether a wallet exists at the given directory
sourcefn get_mnemonic(
&self,
name: Option<&str>,
password: ZeroingString
) -> Result<ZeroingString, Error>
fn get_mnemonic( &self, name: Option<&str>, password: ZeroingString ) -> Result<ZeroingString, Error>
return mnemonic of given wallet
sourcefn validate_mnemonic(&self, mnemonic: ZeroingString) -> Result<(), Error>
fn validate_mnemonic(&self, mnemonic: ZeroingString) -> Result<(), Error>
Check whether a provided mnemonic string is valid
sourcefn recover_from_mnemonic(
&self,
mnemonic: ZeroingString,
password: ZeroingString
) -> Result<(), Error>
fn recover_from_mnemonic( &self, mnemonic: ZeroingString, password: ZeroingString ) -> Result<(), Error>
Recover a seed from phrase, without destroying existing data should back up seed
sourcefn change_password(
&self,
name: Option<&str>,
old: ZeroingString,
new: ZeroingString
) -> Result<(), Error>
fn change_password( &self, name: Option<&str>, old: ZeroingString, new: ZeroingString ) -> Result<(), Error>
changes password
sourcefn wallet_inst(
&mut self
) -> Result<&mut Box<dyn WalletBackend<'a, C, K> + 'a>, Error>
fn wallet_inst( &mut self ) -> Result<&mut Box<dyn WalletBackend<'a, C, K> + 'a>, Error>
return wallet instance