pub struct Wallet { /* private fields */ }Expand description
A wallet containing a mnemonic and derived keys
Implementations§
Source§impl Wallet
impl Wallet
Sourcepub fn new() -> Result<Self, WalletError>
pub fn new() -> Result<Self, WalletError>
Create a new wallet with a random mnemonic
Sourcepub fn from_phrase(phrase: &str) -> Result<Self, WalletError>
pub fn from_phrase(phrase: &str) -> Result<Self, WalletError>
Create a wallet from an existing mnemonic phrase
Sourcepub fn signing_key(&self) -> &SigningKey
pub fn signing_key(&self) -> &SigningKey
Get the signing key for transaction signing
Sourcepub fn address_str(&self) -> String
pub fn address_str(&self) -> String
Get the address as a string
Sourcepub fn save_to_file(
&self,
path: &PathBuf,
password: &str,
) -> Result<(), WalletError>
pub fn save_to_file( &self, path: &PathBuf, password: &str, ) -> Result<(), WalletError>
Save wallet mnemonic to a file, encrypted with password (Argon2id + AES-256-GCM)
Sourcepub fn load_from_file(
path: &PathBuf,
password: &str,
) -> Result<Self, WalletError>
pub fn load_from_file( path: &PathBuf, password: &str, ) -> Result<Self, WalletError>
Load wallet from an encrypted keystore file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Wallet
impl RefUnwindSafe for Wallet
impl Send for Wallet
impl Sync for Wallet
impl Unpin for Wallet
impl UnsafeUnpin for Wallet
impl UnwindSafe for Wallet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more