pub struct WalletBackup;
Expand description
Provides functionality for backing up and recovering Neo wallets.
Implementations§
Source§impl WalletBackup
impl WalletBackup
Sourcepub fn backup(wallet: &Wallet, path: PathBuf) -> Result<(), WalletError>
pub fn backup(wallet: &Wallet, path: PathBuf) -> Result<(), WalletError>
Backs up a wallet to the specified file path.
This method serializes the wallet to JSON format and saves it to the specified file. It’s recommended to store backups in a secure location.
§Arguments
wallet
- The wallet to back uppath
- The file path where the backup will be saved
§Returns
A Result
indicating success or failure
§Example
use std::path::PathBuf;
use neo3::prelude::*;
let wallet = wallets::Wallet::new();
let backup_path = PathBuf::from("wallet_backup.json");
wallets::WalletBackup::backup(&wallet, backup_path).unwrap();
Sourcepub fn recover(path: PathBuf) -> Result<Wallet, WalletError>
pub fn recover(path: PathBuf) -> Result<Wallet, WalletError>
Recovers a wallet from a backup file.
This method reads a wallet backup file in JSON format and deserializes it into a Wallet.
§Arguments
path
- The file path of the backup
§Returns
A Result
containing the recovered wallet or an error
§Example
use std::path::PathBuf;
use neo3::prelude::*;
let backup_path = PathBuf::from("wallet_backup.json");
let recovered_wallet = wallets::WalletBackup::recover(backup_path).unwrap();
Auto Trait Implementations§
impl Freeze for WalletBackup
impl RefUnwindSafe for WalletBackup
impl Send for WalletBackup
impl Sync for WalletBackup
impl Unpin for WalletBackup
impl UnwindSafe for WalletBackup
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more