pub fn account_import(
        // todo: reorder params , ¿what if try to add an account by second time?
        &self,
        created_at: u128,      // todo: maybe should be optional
        last_updated_on: u128, // todo: maybe should be optional
        bip39_mnemonic: String,
        bip39_passphrase: Option<&str>,
        snapshot_password: &str,
        sub_accounts: Vec<SubAccount>, // todo: maybe should be optional?
    ) -> Account {
        if bip39_mnemonic.is_empty() {
            panic!("Invalid parameters: bip39_mnemonic is missing");
        }
        if snapshot_password.is_empty() {
            panic!("Invalid parameters: password is missing");
        }

        let bip39_passphrase = match bip39_passphrase {
            Some(x) => Some(String::from(x)),
            None => None,
        };

        let account = Account::import(
            created_at,
            last_updated_on,
            bip39_mnemonic,
            bip39_passphrase,
            sub_accounts,
        );

        self.account_save(&account, snapshot_password);

        account
    }
/// Imports an existing external account to the snapshot file
///
/// # Some data is required:
///
/// `created_data` date and time in unix epoch in ms of when the account was created.
///
/// `last_updated_on` date and time in unix epoch in ms of when the account had its last update.
///
/// `bip39_mnemonic` word list that is space separated.
///
/// `bip39_passphrase` used to salt the master seed generation. Optional parameter but essential if you had a
/// passphrase, otherwise you won't be able to correctly access your wallet.
///
/// `snapshot_password` password required for decrypt/encrypt the snapshot file.
///
/// `sub_accounts` set of SubAccounts belonging to the account
/// # Example
/// ```no_run
/// use stronghold::Stronghold;
/// let stronghold = Stronghold::new("savings.snapshot");
/// let mnemonic = String::from("gossip region recall forest clip confirm agent grant border spread under lyrics diesel hint mind patch oppose large street panther duty robust city wedding");
/// let snapshot_password = "i:wj38siqo378e54e$";
/// let sub_accounts = Vec::new();
/// let account = stronghold.account_import(1598890069000, 1598890070000, mnemonic, None, &snapshot_password, sub_accounts);
/// ```
Imports an existing external account to the snapshot file
Imports an existing external account to the snapshot file
pub fn account_import(
        // todo: reorder params , ¿what if try to add an account by second time?
        &self,
        created_at: u128,      // todo: maybe should be optional
        last_updated_on: u128, // todo: maybe should be optional
        bip39_mnemonic: String,
        bip39_passphrase: Option<&str>,
        snapshot_password: &str,
        sub_accounts: Vec<SubAccount>, // todo: maybe should be optional?
    ) -> Account {
        if bip39_mnemonic.is_empty() {
            panic!("Invalid parameters: bip39_mnemonic is missing");
        }
        if snapshot_password.is_empty() {
            panic!("Invalid parameters: password is missing");
        }
        let bip39_passphrase = match bip39_passphrase {
            Some(x) => Some(String::from(x)),
            None => None,
        };
        let account = Account::import(
            created_at,
            last_updated_on,
            bip39_mnemonic,
            bip39_passphrase,
            sub_accounts,
        );
        self.account_save(&account, snapshot_password);
        account
    }
pub fn account_import ( // todo: reorder params , ¿what if try to add an account by second time? & self , created_at : u128 , // todo: maybe should be optional last_updated_on : u128 , // todo: maybe should be optional bip39_mnemonic : String , bip39_passphrase : Option < & str > , snapshot_password : & str , sub_accounts : Vec < SubAccount > , // todo: maybe should be optional? ) -> Account { if bip39_mnemonic . is_empty ( ) { panic ! ( " " ) ; } if snapshot_password . is_empty ( ) { panic ! ( " " ) ; } let bip39_passphrase = match bip39_passphrase { Some ( x ) => Some ( String :: from ( x ) ) , None => None , } ; let account = Account :: import ( created_at , last_updated_on , bip39_mnemonic , bip39_passphrase , sub_accounts , ) ; self . account_save ( & account , snapshot_password ) ; account }
Imports an existing external account to the snapshot file
Imports an existing external account to the snapshot file
&self
created_at
u128
last_updated_on
u128
bip39_mnemonic
String
bip39_passphrase
Option<&str>
snapshot_password
&str
sub_accounts
Vec<SubAccount>
some data is required:
`created_data` date and time in unix epoch in ms of when the account was created.

`last_updated_on` date and time in unix epoch in ms of when the account had its last update.

`bip39_mnemonic` word list that is space separated.

`bip39_passphrase` used to salt the master seed generation. Optional parameter but essential if you had a
passphrase, otherwise you won't be able to correctly access your wallet.

`snapshot_password` password required for decrypt/encrypt the snapshot file.

`sub_accounts` set of SubAccounts belonging to the account
` created_data ` date and time in unix epoch in ms of when the account was created . ` last_updated_on ` date and time in unix epoch in ms of when the account had its last update . ` bip39_mnemonic ` word list that is space separated . ` bip39_passphrase ` used to salt the master seed generation . Optional parameter but essential if you had a passphrase otherwise you won ' t be able to correctly access your wallet . ` snapshot_password ` password required for decrypt / encrypt the snapshot file . ` sub_accounts ` set of SubAccounts belonging to the account
example
```no_run
use stronghold::Stronghold;
let stronghold = Stronghold::new("savings.snapshot");
let mnemonic = String::from("gossip region recall forest clip confirm agent grant border spread under lyrics diesel hint mind patch oppose large street panther duty robust city wedding");
let snapshot_password = "i:wj38siqo378e54e$";
let sub_accounts = Vec::new();
let account = stronghold.account_import(1598890069000, 1598890070000, mnemonic, None, &snapshot_password, sub_accounts);
```
` ` ` no_run use stronghold :: Stronghold ; let stronghold = Stronghold :: new ( " savings . snapshot " ) ; let mnemonic = String :: from ( " gossip region recall forest clip confirm agent grant border spread under lyrics diesel hint mind patch oppose large street panther duty robust city wedding " ) ; let snapshot_password = " i : wj38siqo378e54e$ " ; let sub_accounts = Vec :: new () ; let account = stronghold . account_import ( 1598890069000 1598890070000 mnemonic None &snapshot_password sub_accounts ) ; ` ` `