Skip to main content

iota_sdk.wallet.wallet

Wallet Objects

class Wallet()

An IOTA Wallet.

Attributes:

  • handle - The wallet handle.

__init__

def __init__(storage_path: Optional[str] = None,
client_options: Optional[Dict[str, Any]] = None,
coin_type: Optional[int] = None,
secret_manager: Optional[Union[LedgerNanoSecretManager,
MnemonicSecretManager,
SeedSecretManager,
StrongholdSecretManager]] = None)

Initialize self.

get_handle

def get_handle()

Return the wallet handle.

create_account

def create_account(alias: Optional[str] = None,
bech32_hrp: Optional[str] = None,
addresses: Optional[AccountAddress] = None) -> Account

Create a new account.

Arguments:

  • alias - The alias of the newaccount.
  • bech32_hrp - The Bech32 HRP of the new account.

Returns:

An account object.

get_account

def get_account(account_id: Union[str, int]) -> Account

Get the account associated with the given account ID or index.

get_client

def get_client()

Get the client associated with the wallet.

get_secret_manager

def get_secret_manager()

Get the secret manager associated with the wallet.

get_account_data

def get_account_data(account_id: Union[str, int])

Get account data associated with the given account ID or index.

get_accounts

def get_accounts()

Get all accounts.

backup

def backup(destination: str, password: str)

Backup storage.

change_stronghold_password

def change_stronghold_password(password: str)

Change stronghold password.

clear_stronghold_password

def clear_stronghold_password()

Clear stronghold password.

is_stronghold_password_available

def is_stronghold_password_available() -> bool

Return whether a Stronghold password is available.

recover_accounts

def recover_accounts(account_start_index: int,
account_gap_limit: int,
address_gap_limit: int,
sync_options: Optional[SyncOptions] = None)

Recover accounts.

remove_latest_account

def remove_latest_account()

Remove latest account.

restore_backup

def restore_backup(source: str, password: str)

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 the secret_manager, the existing Stronghold file will be overwritten. Be aware that if a mnemonic was stored, it will be lost.

set_client_options

def set_client_options(client_options)

Update the client options for all accounts.

generate_ed25519_address

def generate_ed25519_address(account_index: int,
internal: bool,
address_index: int,
options=None,
bech32_hrp: Optional[str] = None) -> List[str]

Generate an address without storing it.

set_stronghold_password

def set_stronghold_password(password: str)

Set stronghold password.

set_stronghold_password_clear_interval

def set_stronghold_password_clear_interval(interval_in_milliseconds: int)

Set stronghold password clear interval.

store_mnemonic

def store_mnemonic(mnemonic: str)

Store mnemonic.

start_background_sync

def start_background_sync(options: Optional[SyncOptions] = None,
interval_in_milliseconds: Optional[int] = None)

Start background syncing.

stop_background_sync

def stop_background_sync()

Stop background syncing.

listen

def listen(handler, events: Optional[List[int]] = None)

Listen to wallet events, empty array or None will listen to all events. The default value for events is None.

clear_listeners

def clear_listeners(events: Optional[List[int]] = None)

Remove wallet event listeners, empty array or None will remove all listeners. The default value for events is None.

destroy

def destroy()

Destroys the wallet instance.