pub struct AccountManager {
    pub(crate) accounts: Arc<RwLock<Vec<AccountHandle>>>,
    pub(crate) background_syncing_status: Arc<AtomicUsize>,
    pub(crate) client_options: Arc<RwLock<ClientOptions>>,
    pub(crate) coin_type: Arc<AtomicU32>,
    pub(crate) secret_manager: Arc<RwLock<SecretManager>>,
    pub(crate) event_emitter: Arc<Mutex<EventEmitter>>,
    pub(crate) storage_options: StorageOptions,
    pub(crate) storage_manager: Arc<Mutex<StorageManager>>,
}
Expand description

The account manager, used to create and get accounts. One account manager can hold many accounts, but they should all share the same secret_manager type with the same seed/mnemonic.

Fields

accounts: Arc<RwLock<Vec<AccountHandle>>>background_syncing_status: Arc<AtomicUsize>client_options: Arc<RwLock<ClientOptions>>coin_type: Arc<AtomicU32>secret_manager: Arc<RwLock<SecretManager>>event_emitter: Arc<Mutex<EventEmitter>>storage_options: StorageOptionsstorage_manager: Arc<Mutex<StorageManager>>

Implementations

Find accounts with unspent outputs.

Arguments:

  • account_start_index: The index of the first account to search for.
  • account_gap_limit: The number of accounts to search for, after the last account with unspent outputs.
  • address_gap_limit: The number of addresses to search for, after the last address with unspent outputs, in each account.
  • sync_options: Optional parameter to specify the sync options. The address_start_index and force_syncing fields will be overwritten to skip existing addresses.

Returns:

A vector of AccountHandle

Generate new accounts and search for unspent outputs

Start the background syncing process for all accounts, default interval is 7 seconds

Get an account with an AccountIdentifier

Get the ledger nano status

Sets the Stronghold password

Change the Stronghold password to another one and also re-encrypt the values in the loaded snapshot with it.

Sets the Stronghold password clear interval

Stores a mnemonic into the Stronghold vault

Clears the Stronghold password from memory.

Checks if the Stronghold password is available.

Backup the account manager data in a Stronghold file stronghold_password must be the current one when Stronghold is used as SecretManager.

Restore a backup from a Stronghold file Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was stored, it will be gone.

Checks if there is no missing account for example indexes [0, 1, 3] should panic (for now, later return error, automatically fix?) Also checks for each account if there is a gap in an address list and no address is duplicated

Initialises the account manager builder.

Create a new account

Get all accounts

Removes the latest account (account with the largest account index).

Get the SecretManager

Sets the client options for all accounts and sets the new bech32_hrp for the addresses.

Get the used client options

Get the node info

Get the balance of all accounts added together

Sync all accounts

Stop the background syncing of the accounts

Listen to wallet events, empty vec will listen to all events

Remove wallet event listeners, empty vec will remove all listeners

Generates a new random mnemonic.

Verify that a &str is a valid mnemonic.

Helper function to test events. Emits a provided event with account index 0.

Deletes the accounts and database folder.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more