pub struct Wallet {
pub name: String,
pub path: String,
pub hotkey: String,
/* private fields */
}Fields§
§name: String§path: String§hotkey: StringImplementations§
Source§impl Wallet
impl Wallet
Sourcepub fn new(
name: Option<String>,
hotkey: Option<String>,
path: Option<String>,
config: Option<Config>,
) -> Self
pub fn new( name: Option<String>, hotkey: Option<String>, path: Option<String>, config: Option<Config>, ) -> Self
Initialize the bittensor wallet object containing a hot and coldkey.
Arguments:
name (Optional[str]): The name of the wallet. Defaults to "default".
hotkey (Optional[str]): The name of hotkey. Defaults to "default".
path (Optional[str]): The path to wallets. Defaults to "~/.bittensor/wallets/".
config (Optional[Config]): Optional configuration.
Returns:
`Wallet` - A new Wallet instance.pub fn add_args(parser: Command, _prefix: Option<&str>) -> Command
Sourcepub fn create_if_non_existent(
&mut self,
coldkey_use_password: bool,
hotkey_use_password: bool,
save_coldkey_to_env: bool,
save_hotkey_to_env: bool,
coldkey_password: Option<String>,
hotkey_password: Option<String>,
overwrite: bool,
suppress: bool,
) -> Result<Self, WalletError>
pub fn create_if_non_existent( &mut self, coldkey_use_password: bool, hotkey_use_password: bool, save_coldkey_to_env: bool, save_hotkey_to_env: bool, coldkey_password: Option<String>, hotkey_password: Option<String>, overwrite: bool, suppress: bool, ) -> Result<Self, WalletError>
Checks for existing coldkeypub, hotkeypub, hotkeys, and creates them if non-existent.
Arguments:
coldkey_use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
hotkey_use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save a coldkey password to local env. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save a hotkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``. If `coldkey_password` is passed, then `coldkey_use_password` is automatically ``True``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `hotkey_use_password` is automatically ``True``.
overwrite (bool): Whether to overwrite an existing keys. Defaults to ``False``.
suppress (bool): If ``True``, suppresses the display of the keys mnemonic message. Defaults to ``False``.
Returns:
`Wallet` - The wallet instance with created keys.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn create(
&mut self,
coldkey_use_password: bool,
hotkey_use_password: bool,
save_coldkey_to_env: bool,
save_hotkey_to_env: bool,
coldkey_password: Option<String>,
hotkey_password: Option<String>,
overwrite: bool,
suppress: bool,
) -> Result<Self, WalletError>
pub fn create( &mut self, coldkey_use_password: bool, hotkey_use_password: bool, save_coldkey_to_env: bool, save_hotkey_to_env: bool, coldkey_password: Option<String>, hotkey_password: Option<String>, overwrite: bool, suppress: bool, ) -> Result<Self, WalletError>
Checks for existing coldkeypub and hotkeys, and creates them if non-existent.
Arguments:
coldkey_use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
hotkey_use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save a coldkey password to local env. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save a hotkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``. If `coldkey_password` is passed, then `coldkey_use_password` is automatically ``True``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `hotkey_use_password` is automatically ``True``.
overwrite (bool): Whether to overwrite an existing keys. Defaults to ``False``.
suppress (bool): If ``True``, suppresses the display of the keys mnemonic message. Defaults to ``False``.
Returns:
Wallet instance with created keys.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn recreate(
&mut self,
coldkey_use_password: bool,
hotkey_use_password: bool,
save_coldkey_to_env: bool,
save_hotkey_to_env: bool,
coldkey_password: Option<String>,
hotkey_password: Option<String>,
overwrite: bool,
suppress: bool,
) -> Result<Self, WalletError>
pub fn recreate( &mut self, coldkey_use_password: bool, hotkey_use_password: bool, save_coldkey_to_env: bool, save_hotkey_to_env: bool, coldkey_password: Option<String>, hotkey_password: Option<String>, overwrite: bool, suppress: bool, ) -> Result<Self, WalletError>
Checks for existing coldkeypub and hotkeys, and recreates them if non-existent.
Arguments:
coldkey_use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
hotkey_use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save a coldkey password to local env. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save a hotkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``. If `coldkey_password` is passed, then `coldkey_use_password` is automatically ``True``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `hotkey_use_password` is automatically ``True``.
overwrite (bool): Whether to overwrite an existing keys. Defaults to ``False``.
suppress (bool): If ``True``, suppresses the display of the keys mnemonic message. Defaults to ``False``.
Returns:
Wallet instance with created keys.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn hotkey_file(&self) -> Result<Keyfile, KeyFileError>
pub fn hotkey_file(&self) -> Result<Keyfile, KeyFileError>
Returns the hotkey file.
Sourcepub fn create_hotkey_file(
&self,
save_hotkey_to_env: bool,
) -> Result<Keyfile, KeyFileError>
pub fn create_hotkey_file( &self, save_hotkey_to_env: bool, ) -> Result<Keyfile, KeyFileError>
Creates a new hotkey file for the keypair.
Arguments:
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
Returns:
`Keyfile` - The created hotkey file.
Raises:
KeyFileError: If file creation fails.Sourcepub fn coldkey_file(&self) -> Result<Keyfile, KeyFileError>
pub fn coldkey_file(&self) -> Result<Keyfile, KeyFileError>
Returns the coldkey file.
Sourcepub fn create_coldkey_file(
&self,
save_coldkey_to_env: bool,
) -> Result<Keyfile, KeyFileError>
pub fn create_coldkey_file( &self, save_coldkey_to_env: bool, ) -> Result<Keyfile, KeyFileError>
Creates a new coldkey file for the keypair.
Arguments:
save_coldkey_to_env (bool): Whether to save coldkey password to local env. Defaults to ``False``.
Returns:
`Keyfile` - The created coldkey file.
Raises:
KeyFileError: If file creation fails.Sourcepub fn hotkeypub_file(&self) -> Result<Keyfile, KeyFileError>
pub fn hotkeypub_file(&self) -> Result<Keyfile, KeyFileError>
Returns the hotkeypub file.
Sourcepub fn coldkeypub_file(&self) -> Result<Keyfile, KeyFileError>
pub fn coldkeypub_file(&self) -> Result<Keyfile, KeyFileError>
Returns the coldkeypub file.
Sourcepub fn coldkey_property(&self) -> Result<Keypair, KeyFileError>
pub fn coldkey_property(&self) -> Result<Keypair, KeyFileError>
Returns the coldkey from wallet.path/wallet.name/coldkey or raises an error.
Sourcepub fn coldkeypub_property(&self) -> Result<Keypair, KeyFileError>
pub fn coldkeypub_property(&self) -> Result<Keypair, KeyFileError>
Returns the coldkeypub from wallet.path/wallet.name/coldkeypub.txt or raises an error.
Sourcepub fn hotkey_property(&self) -> Result<Keypair, KeyFileError>
pub fn hotkey_property(&self) -> Result<Keypair, KeyFileError>
Returns the hotkey from wallet.path/wallet.name/hotkeys/wallet.hotkey or raises an error.
Sourcepub fn hotkeypub_property(&self) -> Result<Keypair, KeyFileError>
pub fn hotkeypub_property(&self) -> Result<Keypair, KeyFileError>
Returns the hotkeypub from wallet.path/wallet.name/hotkeypub.txt or raises an error.
Sourcepub fn get_hotkey_str(&self) -> String
pub fn get_hotkey_str(&self) -> String
Returns the hotkey name
Sourcepub fn set_coldkey(
&mut self,
keypair: Keypair,
encrypt: bool,
overwrite: bool,
save_coldkey_to_env: bool,
coldkey_password: Option<String>,
) -> Result<(), KeyFileError>
pub fn set_coldkey( &mut self, keypair: Keypair, encrypt: bool, overwrite: bool, save_coldkey_to_env: bool, coldkey_password: Option<String>, ) -> Result<(), KeyFileError>
Sets the coldkey for the wallet.
Arguments:
keypair (Keypair): The keypair to set as coldkey.
encrypt (bool): Whether to encrypt the key. Defaults to ``True``.
overwrite (bool): Whether to overwrite if key exists. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save coldkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``.
Raises:
KeyFileError: If file operations fail.Sourcepub fn set_coldkeypub(
&mut self,
keypair: Keypair,
encrypt: bool,
overwrite: bool,
) -> Result<(), KeyFileError>
pub fn set_coldkeypub( &mut self, keypair: Keypair, encrypt: bool, overwrite: bool, ) -> Result<(), KeyFileError>
Sets the coldkeypub for the wallet.
Arguments:
keypair (Keypair): The keypair to set as coldkeypub.
encrypt (bool): Whether to encrypt the key. Defaults to ``False``.
overwrite (bool): Whether to overwrite if key exists. Defaults to ``False``.
Raises:
KeyFileError: If file operations fail.Sourcepub fn set_hotkey(
&mut self,
keypair: Keypair,
encrypt: bool,
overwrite: bool,
save_hotkey_to_env: bool,
hotkey_password: Option<String>,
) -> Result<(), KeyFileError>
pub fn set_hotkey( &mut self, keypair: Keypair, encrypt: bool, overwrite: bool, save_hotkey_to_env: bool, hotkey_password: Option<String>, ) -> Result<(), KeyFileError>
Sets the hotkey for the wallet.
Arguments:
keypair (Keypair): The keypair to set as hotkey.
encrypt (bool): Whether to encrypt the key. Defaults to ``False``.
overwrite (bool): Whether to overwrite if key exists. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``.
Raises:
KeyFileError: If file operations fail.Sourcepub fn set_hotkeypub(
&mut self,
keypair: Keypair,
encrypt: bool,
overwrite: bool,
) -> Result<(), KeyFileError>
pub fn set_hotkeypub( &mut self, keypair: Keypair, encrypt: bool, overwrite: bool, ) -> Result<(), KeyFileError>
Sets the hotkeypub for the wallet.
Arguments:
keypair (Keypair): The keypair to set as hotkeypub.
encrypt (bool): Whether to encrypt the key. Defaults to ``False``.
overwrite (bool): Whether to overwrite if key exists. Defaults to ``False``.
Raises:
KeyFileError: If file operations fail.Sourcepub fn get_coldkey(
&self,
password: Option<String>,
) -> Result<Keypair, KeyFileError>
pub fn get_coldkey( &self, password: Option<String>, ) -> Result<Keypair, KeyFileError>
Gets the coldkey from the wallet.
Arguments:
password (Optional[str]): Password for decryption. Defaults to ``None``. If not provided, asks for user input.
Returns:
`Keypair` - The coldkey keypair.
Raises:
KeyFileError: If the coldkey file doesn't exist or decryption fails.Sourcepub fn get_coldkeypub(
&self,
password: Option<String>,
) -> Result<Keypair, KeyFileError>
pub fn get_coldkeypub( &self, password: Option<String>, ) -> Result<Keypair, KeyFileError>
Gets the coldkeypub from the wallet.
Arguments:
password (Optional[str]): Password for decryption. Defaults to ``None``. If not provided, asks for user input.
Returns:
`Keypair` - The coldkeypub keypair.
Raises:
KeyFileError: If the coldkeypub file doesn't exist or decryption fails.Sourcepub fn get_hotkey(
&self,
password: Option<String>,
) -> Result<Keypair, KeyFileError>
pub fn get_hotkey( &self, password: Option<String>, ) -> Result<Keypair, KeyFileError>
Gets the hotkey from the wallet.
Arguments:
password (Optional[str]): Password for decryption. Defaults to ``None``. If not provided, asks for user input.
Returns:
`Keypair` - The hotkey keypair.
Raises:
KeyFileError: If the hotkey file doesn't exist or decryption fails.Sourcepub fn get_hotkeypub(
&self,
password: Option<String>,
) -> Result<Keypair, KeyFileError>
pub fn get_hotkeypub( &self, password: Option<String>, ) -> Result<Keypair, KeyFileError>
Gets the hotkeypub from the wallet.
Arguments:
password (Optional[str]): Password for decryption. Defaults to ``None``. If not provided, asks for user input.
Returns:
`Keypair` - The hotkeypub keypair.
Raises:
KeyFileError: If the hotkeypub file doesn't exist or decryption fails.Sourcepub fn create_coldkey_from_uri(
&mut self,
uri: String,
use_password: bool,
overwrite: bool,
suppress: bool,
save_coldkey_to_env: bool,
coldkey_password: Option<String>,
) -> Result<Wallet, KeyFileError>
pub fn create_coldkey_from_uri( &mut self, uri: String, use_password: bool, overwrite: bool, suppress: bool, save_coldkey_to_env: bool, coldkey_password: Option<String>, ) -> Result<Wallet, KeyFileError>
Creates coldkey from uri string, optionally encrypts it with the user-provided password.
Arguments:
uri (str): The URI string to create the coldkey from.
use_password (bool): Whether to use a password for coldkey. Defaults to ``False``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``True``.
save_coldkey_to_env (bool): Whether to save coldkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``.
Returns:
`Wallet` - The wallet instance with created coldkey.
Raises:
KeyFileError: If key creation or file operations fail.Sourcepub fn create_hotkey_from_uri(
&mut self,
uri: String,
use_password: bool,
overwrite: bool,
suppress: bool,
save_hotkey_to_env: bool,
hotkey_password: Option<String>,
) -> Result<Wallet, KeyFileError>
pub fn create_hotkey_from_uri( &mut self, uri: String, use_password: bool, overwrite: bool, suppress: bool, save_hotkey_to_env: bool, hotkey_password: Option<String>, ) -> Result<Wallet, KeyFileError>
Creates hotkey from uri string, optionally encrypts it with the user-provided password.
Arguments:
uri (str): The URI string to create the hotkey from.
use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``True``.
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``.
Returns:
`Wallet` - The wallet instance with created hotkey.
Raises:
KeyFileError: If key creation or file operations fail.Sourcepub fn unlock_coldkey(&mut self) -> Result<Keypair, KeyFileError>
pub fn unlock_coldkey(&mut self) -> Result<Keypair, KeyFileError>
Unlocks the coldkey.
Sourcepub fn unlock_coldkeypub(&mut self) -> Result<Keypair, KeyFileError>
pub fn unlock_coldkeypub(&mut self) -> Result<Keypair, KeyFileError>
Unlocks the coldkeypub.
Sourcepub fn unlock_hotkey(&mut self) -> Result<Keypair, KeyFileError>
pub fn unlock_hotkey(&mut self) -> Result<Keypair, KeyFileError>
Unlocks the hotkey.
Sourcepub fn unlock_hotkeypub(&mut self) -> Result<Keypair, KeyFileError>
pub fn unlock_hotkeypub(&mut self) -> Result<Keypair, KeyFileError>
Unlocks the hotkeypub.
Sourcepub fn new_coldkey(
&mut self,
n_words: usize,
use_password: bool,
overwrite: bool,
suppress: bool,
save_coldkey_to_env: bool,
coldkey_password: Option<String>,
) -> Result<Wallet, WalletError>
pub fn new_coldkey( &mut self, n_words: usize, use_password: bool, overwrite: bool, suppress: bool, save_coldkey_to_env: bool, coldkey_password: Option<String>, ) -> Result<Wallet, WalletError>
Creates a new coldkey, optionally encrypts it with the user-provided password and saves to disk.
Arguments:
n_words (int): The number of words in the mnemonic. Defaults to 12.
use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save coldkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``. If `coldkey_password` is passed, then `use_password` is automatically ``True``.
Returns:
`Wallet` - The wallet instance with created coldkey.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn new_hotkey(
&mut self,
n_words: usize,
use_password: bool,
overwrite: bool,
suppress: bool,
save_hotkey_to_env: bool,
hotkey_password: Option<String>,
) -> Result<Self, WalletError>
pub fn new_hotkey( &mut self, n_words: usize, use_password: bool, overwrite: bool, suppress: bool, save_hotkey_to_env: bool, hotkey_password: Option<String>, ) -> Result<Self, WalletError>
Creates a new hotkey, optionally encrypts it with the user-provided password and saves to disk.
Arguments:
n_words (int): The number of words in the mnemonic. Defaults to 12.
use_password (bool): Whether to use a password for hotkey. Defaults to ``True``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `use_password` is automatically ``True``.
Returns:
`Wallet` - The wallet instance with created hotkey.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn create_new_hotkey(
&mut self,
n_words: usize,
use_password: bool,
overwrite: bool,
suppress: bool,
save_hotkey_to_env: bool,
hotkey_password: Option<String>,
) -> Result<Wallet, WalletError>
pub fn create_new_hotkey( &mut self, n_words: usize, use_password: bool, overwrite: bool, suppress: bool, save_hotkey_to_env: bool, hotkey_password: Option<String>, ) -> Result<Wallet, WalletError>
Creates a new hotkey, optionally encrypts it with the user-provided password and saves to disk.
Arguments:
n_words (int): The number of words in the mnemonic. Defaults to 12.
use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `use_password` is automatically ``True``.
Returns:
`Wallet` - The wallet instance with created hotkey.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn regenerate_coldkey(
&mut self,
mnemonic: Option<String>,
seed: Option<String>,
json: Option<(String, String)>,
use_password: bool,
overwrite: bool,
suppress: bool,
save_coldkey_to_env: bool,
coldkey_password: Option<String>,
) -> Result<Self, WalletError>
pub fn regenerate_coldkey( &mut self, mnemonic: Option<String>, seed: Option<String>, json: Option<(String, String)>, use_password: bool, overwrite: bool, suppress: bool, save_coldkey_to_env: bool, coldkey_password: Option<String>, ) -> Result<Self, WalletError>
Regenerates the coldkey from the passed mnemonic or seed, or JSON encrypts it with the user’s password and saves the file.
Arguments:
mnemonic (Optional[str]): Mnemonic phrase to regenerate the coldkey from. Defaults to ``None``.
seed (Optional[str]): Seed hex to regenerate the coldkey from. Defaults to ``None``.
json (Optional[tuple]): Tuple of (JSON data, passphrase) to regenerate the coldkey from. Defaults to ``None``.
use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``False``.
save_coldkey_to_env (bool): Whether to save coldkey password to local env. Defaults to ``False``.
coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``.
Returns:
`Wallet` - The wallet instance with regenerated coldkey.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn regenerate_coldkeypub(
&mut self,
ss58_address: Option<String>,
public_key: Option<String>,
overwrite: bool,
) -> Result<Self, WalletError>
pub fn regenerate_coldkeypub( &mut self, ss58_address: Option<String>, public_key: Option<String>, overwrite: bool, ) -> Result<Self, WalletError>
Regenerates the coldkeypub from the passed ss58_address or public_key and saves the file. Requires either ss58_address or public_key to be passed.
Arguments:
ss58_address (Optional[str]): SS58 address to regenerate the coldkeypub from. Defaults to ``None``.
public_key (Optional[str]): Public key hex to regenerate the coldkeypub from. Defaults to ``None``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
Returns:
`Wallet` - The wallet instance with regenerated coldkeypub.
Raises:
WalletError: If key generation or file operations fail.Sourcepub fn regenerate_hotkey(
&mut self,
mnemonic: Option<String>,
seed: Option<String>,
json: Option<(String, String)>,
use_password: bool,
overwrite: bool,
suppress: bool,
save_hotkey_to_env: bool,
hotkey_password: Option<String>,
) -> Result<Self, KeyFileError>
pub fn regenerate_hotkey( &mut self, mnemonic: Option<String>, seed: Option<String>, json: Option<(String, String)>, use_password: bool, overwrite: bool, suppress: bool, save_hotkey_to_env: bool, hotkey_password: Option<String>, ) -> Result<Self, KeyFileError>
Regenerates the hotkey from passed mnemonic or seed, encrypts it with the user’s password and saves the file.
Arguments:
mnemonic (Optional[str]): Mnemonic phrase to regenerate the hotkey from. Defaults to ``None``.
seed (Optional[str]): Seed hex to regenerate the hotkey from. Defaults to ``None``.
json (Optional[tuple]): Tuple of (JSON data, passphrase) to regenerate the hotkey from. Defaults to ``None``.
use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
suppress (bool): Whether to suppress mnemonic display. Defaults to ``False``.
save_hotkey_to_env (bool): Whether to save hotkey password to local env. Defaults to ``False``.
hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``.
Returns:
`Wallet` - The wallet instance with regenerated hotkey.
Raises:
KeyFileError: If key generation or file operations fail.Sourcepub fn regenerate_hotkeypub(
&mut self,
ss58_address: Option<String>,
public_key: Option<String>,
overwrite: bool,
) -> Result<Self, WalletError>
pub fn regenerate_hotkeypub( &mut self, ss58_address: Option<String>, public_key: Option<String>, overwrite: bool, ) -> Result<Self, WalletError>
Regenerates the hotkeypub from the passed ss58_address or public_key and saves the file. Requires either ss58_address or public_key to be passed.
Arguments:
ss58_address (Optional[str]): SS58 address to regenerate the hotkeypub from. Defaults to ``None``.
public_key (Optional[str]): Public key hex to regenerate the hotkeypub from. Defaults to ``None``.
overwrite (bool): Whether to overwrite existing keys. Defaults to ``False``.
Returns:
`Wallet` - The wallet instance with regenerated hotkeypub.
Raises:
WalletError: If key generation or file operations fail.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.