Wallet

Wallet

class Wallet(**kwargs)

Implements the wallet api endpoints.

mnemonic(language: str = 'English', word_count: int = 12, **kwargs) List[str]

Generates a mnemonic to use for an HD wallet. For more information about mnemonics, see BIP39.

Parameters:
  • language (str) – The language used to generate mnemonic.

  • word_count (int) – Count of words needs to be generated.

  • **kwargs – Extra keyword arguments.

Returns:

The generated mnemonic.

Return type:

List[str]

Raises:

APIError – Error thrown by node API. See message for details.

create(name: str, password: str, passphrase: str, mnemonic: str | None = None, **kwargs) List[str]

Creates a new wallet on this full node.

Parameters:
  • mnemonic (str, optional) – The mnemonic used to create a HD wallet. If not specified, it will be randomly generated underhood.

  • password (str) – The password for a wallet to be created.

  • passphrase (str) – The passphrase used in master key generation.

  • name – (str): The name for a wallet to be created.

  • **kwargs – Extra keyword arguments.

Returns:

The mnemonic used to generate this HD wallet.

Return type:

List[str]

Raises:

APIError – Error thrown by node API. See message for details.

sign_message(wallet_name: str, password: str, external_address: Address | str, message: str, **kwargs) str

Signs a message and returns the signature.

Parameters:
  • wallet_name (str) – The name of the wallet to sign message with.

  • password (str) – The password of the wallet to sign message with.

  • external_address (Address, str) – The external address of a private key used to sign message.

  • message (str) – The message to be signed.

  • **kwargs – Extra keyword arguments.

Returns:

The signature of the message.

Return type:

str

Raises:

APIError – Error thrown by node API. See message for details.

pubkey(wallet_name: str, external_address: Address | str, **kwargs) PubKey

Gets the public key for an address.

Parameters:
  • wallet_name (str) – The name of the wallet to search for pubkey in.

  • external_address (Address, str) – The external address of a wanted pubkey.

  • **kwargs – Extra keyword arguments.

Returns:

The requested public key.

Return type:

PubKey

Raises:

APIError – Error thrown by node API. See message for details.

verify_message(signature: str, external_address: Address | str, message: str, **kwargs) bool

Verifies the signature of a message.

Parameters:
  • signature (str) – The signature to be verified.

  • external_address (Address, str) – The address of the signer.

  • message (str) – The message that was signed.

  • **kwargs – Extra keyword arguments.

Returns:

True if signature is verified, False otherwise.

Return type:

bool

Raises:

APIError – Error thrown by node API. See message for details.

load(name: str, password: str, **kwargs) None

Loads a previously created wallet.

Parameters:
  • name (str) – The wallet name to load.

  • password (str) – The wallet password.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

recover(mnemonic: str, password: str, passphrase: str, name: str, creation_date: str | None = None, **kwargs) None

Recovers an existing wallet.

Parameters:
  • mnemonic (str) – A mnemonic for initializing a wallet.

  • password (str) – The password for the wallet.

  • passphrase (str) – The passphrase for the wallet.

  • name (str) – The name for the wallet.

  • creation_date (str, datetime, optional) – An estimate of the wallet creation date.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

recover_via_extpubkey(extpubkey: ExtPubKey | str | hexstr, account_index: int, name: str, creation_date: str, **kwargs) None

Recovers a wallet using its extended public key.

Parameters:
  • extpubkey (ExtPubKey, str, hexstr) – The extpubkey for the recovered wallet.

  • account_index (int) – The account index.

  • name (str) – The wallet name.

  • creation_date (str, datetime, optional) – An estimate of the wallet creation date.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

general_info(name: str, **kwargs) WalletGeneralInfoModel

Gets some general information about a wallet.

Parameters:
  • name (str) – The wallet name.

  • **kwargs – Extra keyword arguments.

Returns:

General information about the wallet.

Return type:

WalletGeneralInfoModel

Raises:

APIError – Error thrown by node API. See message for details.

transaction_count(wallet_name: str, account_name: str = 'account 0', **kwargs) int

Get the transaction count for the specified Wallet and Account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • **kwargs – Extra keyword arguments.

Returns:

The number of transactions.

Return type:

int

Raises:

APIError – Error thrown by node API. See message for details.

history(wallet_name: str, account_name: str = 'account 0', address: Address | str | None = None, skip: int = 0, take: int | None = None, prev_output_tx_time: int | None = None, prev_output_index: int | None = None, search_query: str | None = None, **kwargs) WalletHistoryModel

Gets the history of a wallet.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • address (Address, str, optional) – The address to query the history.

  • skip (conint(ge=0), optional) – The number of history items to skip.

  • take (conint(ge=0), optional) – The number of history items to take.

  • prev_output_tx_time (conint(ge=0), optional) – The previous output transaction time.

  • prev_output_index (conint(ge=0), optional) – The previous output transaction index.

  • search_query (str, optional) – A search query.

  • **kwargs – Extra keyword arguments.

Returns:

The wallet history.

Return type:

WalletHistoryModel

Raises:

APIError – Error thrown by node API. See message for details.

balance(wallet_name: str, account_name: str = 'account 0', include_balance_by_address: bool = False, **kwargs) WalletBalanceModel

Gets the balance of a wallet in STRAX (or sidechain coin). Both the confirmed and unconfirmed balance are returned.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • include_balance_by_address (bool, optional) – If true, includes detailed information about balances by address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

The wallet balance.

Return type:

WalletBalanceModel

Raises:

APIError – Error thrown by node API. See message for details.

received_by_address(address: Address | str, **kwargs) AddressBalanceModel

Retrieves transactions received by the specified address.

Parameters:
  • address (Address) – The address to query.

  • **kwargs – Extra keyword arguments.

Returns:

The transactions associated with the address.

Return type:

AddressBalanceModel

Raises:

APIError – Error thrown by node API. See message for details.

max_balance(wallet_name: str, fee_type: str, account_name: str = 'account 0', allow_unconfirmed: bool = False, **kwargs) MaxSpendableAmountModel

Gets the maximum spendable balance for an account along with the fee required to spend it.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • fee_type (str) – The fee type. Allowed [low, medium, high]

  • allow_unconfirmed (bool, optional) – If True, allow unconfirmed utxo in request. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

Information about the maximum spendable amount and fee to send.

Return type:

MaxSpendableAmountModel

Raises:

APIError – Error thrown by node API. See message for details.

spendable_transactions(wallet_name: str, account_name: str = 'account 0', min_confirmations: int = 0, **kwargs) SpendableTransactionsModel

Gets the spendable transactions for an account with the option to specify how many confirmations a transaction needs to be included.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • min_confirmations (int, optional) – Get spendable transactions less this value from chain tip. Default=0.

  • **kwargs – Extra keyword arguments.

Returns:

Spendable transactions.

Return type:

SpendableTransactionsModel

Raises:

APIError – Error thrown by node API. See message for details.

estimate_txfee(wallet_name: str, outpoints: List[Outpoint], recipients: List[Recipient], op_return_data: str | None = None, op_return_amount: Money | None = None, fee_type: str | None = None, allow_unconfirmed: bool = False, shuffle_outputs: bool = False, change_address: Address | None = None, account_name: str = 'account 0', **kwargs) Money

Gets a fee estimate for a specific transaction.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • outpoints (List[Outpoint]) – A list of outpoints to include in the transaction.

  • recipients (List[Recipient]) – A list of recipients with amounts.

  • op_return_data (str, optional) – The OP_RETURN data.

  • op_return_amount (Money, int, float, Decimal, optional) – The amount to burn in OP_RETURN.

  • fee_type (str, optional) – The fee type. Allowed [low, medium, high]

  • allow_unconfirmed (bool, optional) – If True, includes unconfirmed outputs. Default=False.

  • shuffle_outputs (bool, optional) – If True, shuffle outputs. Default=False.

  • change_address (Address, str, optional) – Specify a change address. If not set, a new change address is used.

  • **kwargs – Extra keyword arguments.

Returns:

An estimate of the transaction fee.

Return type:

Money

Raises:

APIError – Error thrown by node API. See message for details.

build_transaction(wallet_name: str, password: str, outpoints: List[Outpoint], recipients: List[Recipient], fee_amount: Money | int | float | Decimal | None = None, segwit_change_address: bool = False, op_return_data: str | None = None, op_return_amount: Money | int | float | Decimal | None = None, fee_type: str | None = None, allow_unconfirmed: bool = False, shuffle_outputs: bool = False, account_name: str = 'account 0', change_address: Address | str | None = None, **kwargs) BuildTransactionModel

Builds a transaction and returns the hex to use when executing the transaction.

Parameters:
  • fee_amount (Money, int, float, Decimal, optional) – The fee amount. Cannot be set with fee_type.

  • password (str) – The password.

  • segwit_change_address (bool, optional) – If True, the change address is a segwit address. Default=False.

  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • outpoints (List[Outpoint]) – A list of outpoints to include in the transaction.

  • recipients (List[Recipient]) – A list of recipients with amounts.

  • op_return_data (str, optional) – The OP_RETURN data.

  • op_return_amount (Money, int, float, Decimal, optional) – The amount to burn in OP_RETURN.

  • fee_type (str, optional) – The fee type. Allowed [low, medium, high]

  • allow_unconfirmed (bool, optional) – If True, includes unconfirmed outputs. Default=False.

  • shuffle_outputs (bool, optional) – If True, shuffle outputs. Default=False.

  • change_address (Address, str, optional) – Specify a change address. If not set, a new change address is used.

  • **kwargs – Extra keyword arguments.

Returns:

A built transaction.

Return type:

BuildTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

build_interflux_transaction(wallet_name: str, password: str, destination_chain: int, destination_address: Address | str, outpoints: List[Outpoint], recipients: List[Recipient], fee_amount: Money | int | float | Decimal | None = None, segwit_change_address: bool = False, op_return_data: str | None = None, op_return_amount: Money | int | float | Decimal | None = None, fee_type: str | None = None, allow_unconfirmed: bool = False, shuffle_outputs: bool = False, account_name: str = 'account 0', change_address: Address | str | None = None, **kwargs) BuildTransactionModel

Builds a transaction and returns the hex to use when executing the transaction.

Parameters:
  • destination_chain (int) – Enumeration representing the destination chain.

  • destination_address (Address, str) – The destination address.

  • fee_amount (Money, int, float, Decimal, optional) – The fee amount. Cannot be set with fee_type.

  • password (str) – The password.

  • segwit_change_address (bool, optional) – If True, the change address is a segwit address.

  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • outpoints (List[Outpoint]) – A list of outpoints to include in the transaction.

  • recipients (List[Recipient]) – A list of recipients with amounts.

  • op_return_data (str, optional) – The OP_RETURN data.

  • op_return_amount (Money, int, float, Decimal, optional) – The amount to burn in OP_RETURN.

  • fee_type (str, optional) – The fee type. Allowed [low, medium, high]

  • allow_unconfirmed (bool, optional) – If True, includes unconfirmed outputs. Default=False.

  • shuffle_outputs (bool, optional) – If True, shuffle outputs. Default=False.

  • change_address (Address, str, optional) – Specify a change address. If not set, a new change address is used.

  • **kwargs – Extra keyword arguments.

Returns:

A built interflux transaction.

Return type:

BuildTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

send_transaction(transaction_hex: str | hexstr, **kwargs) WalletSendTransactionModel

Sends a transaction that has already been built.

Parameters:
  • transaction_hex (hexstr, str) – The hexified transaction.

  • **kwargs – Extra keyword arguments.

Returns:

Information about a sent transaction.

Return type:

WalletSendTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

list_wallets(**kwargs) dict

Lists all the files found in the database

Parameters:

**kwargs – Extra keyword arguments.

Returns:

A list of wallets.

Return type:

dict

Raises:

APIError – Error thrown by node API. See message for details.

account(wallet_name: str, password: str, **kwargs) str

Creates a new account for a wallet.

Parameters:
  • password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • **kwargs – Extra keyword arguments.

Returns:

The newly created account name.

Return type:

str

Raises:

APIError – Error thrown by node API. See message for details.

accounts(wallet_name: str, **kwargs) List[str]

Gets a list of accounts for the specified wallet.

Parameters:
  • wallet_name (str) – The wallet name.

  • **kwargs – Extra keyword arguments.

Returns:

A list of accounts.

Return type:

List[str]

Raises:

APIError – Error thrown by node API. See message for details.

unused_address(wallet_name: str, account_name: str = 'account 0', segwit: bool = False, **kwargs) Address

Gets an unused address (in the Base58 format) for a wallet account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • segwit (bool, optional) – If True, get a segwit address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

An unused address.

Return type:

Address

Raises:

APIError – Error thrown by node API. See message for details.

unused_addresses(wallet_name: str, count: int, account_name: str = 'account 0', segwit: bool = False, **kwargs) List[Address]

Gets a specified number of unused addresses (in the Base58 format) for a wallet account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • count (int) – The number of addresses to get.

  • segwit (bool, optional) – If True, get a segwit address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

A list of unused addresses.

Return type:

List[Address]

Raises:

APIError – Error thrown by node API. See message for details.

new_addresses(wallet_name: str, count: int, account_name: str = 'account 0', segwit: bool = False, **kwargs) List[Address]

Gets a specified number of new addresses (in the Base58 format) for a wallet account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • count (conint(ge=1)) – The number of addresses to get.

  • segwit (bool, optional) – If True, get a segwit address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

A new address.

Return type:

List[Address]

Raises:

APIError – Error thrown by node API. See message for details.

addresses(wallet_name: str, account_name: str = 'account 0', segwit: bool = False, **kwargs) AddressesModel

Gets all addresses for a wallet account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • segwit (bool, optional) – If True, gets a segwit address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

All addresses associated with the account given.

Return type:

AddressesModel

Raises:

APIError – Error thrown by node API. See message for details.

remove_transactions(wallet_name: str, ids: List[str | uint256] | None = None, from_date: str | None = None, remove_all: bool = False, resync: bool = True, **kwargs) List[RemovedTransactionModel]

Removes transactions from the wallet.

Parameters:
  • wallet_name (str) – The wallet name.

  • ids (List[uint256, str], optional) – A list of transaction ids to remove.

  • from_date (str, optional) – An option to remove transactions after given date.

  • remove_all (bool, optional) – An option to remove all transactions. Default=False.

  • resync (bool, optional) – If True, resyncs wallet after items removed. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

A list of removed transactions.

Return type:

List[RemovedTransactionModel]

Raises:

APIError – Error thrown by node API. See message for details.

remove_wallet(wallet_name: str, **kwargs) None

Remove a wallet

Parameters:
  • wallet_name (str) – The wallet name.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

extpubkey(wallet_name: str, account_name: str = 'account 0', **kwargs) ExtPubKey

Gets the extended public key of a specified wallet account.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • **kwargs – Extra keyword arguments.

Returns:

ExtPubKey

Raises:

APIError – Error thrown by node API. See message for details.

private_key(password: str, wallet_name: str, address: Address | str, **kwargs) Key

Gets the private key of a specified wallet address.

Parameters:
  • password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • address (Address, str) – The address to request a private key for.

  • **kwargs – Extra keyword arguments.

Returns:

The private key.

Return type:

Key

Raises:

APIError – Error thrown by node API. See message for details.

sync(block_hash: uint256 | str, **kwargs) None

Requests the node resyncs from a block specified by its block hash.

Parameters:
  • block_hash (uint256, str) – The hash to start syncing from.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

sync_from_date(wallet_name: str, date: str, all_transactions: bool = True, **kwargs) None

Request the node resyncs starting from a given date and time.

Parameters:
  • date (str) – The date to sync from in YYYY-MM-DDTHH:MM:SS format.

  • all_transactions (bool, optional) – If True, sync all transactions. Default=True.

  • wallet_name (str) – The wallet name.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

wallet_stats(wallet_name: str, account_name: str = 'account 0', min_confirmations: int = 0, verbose: bool = True, **kwargs) WalletStatsModel

Retrieves information about the wallet.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • min_confirmations (int, optional) – Include transaction less this amount from the chain tip. Default=0.

  • verbose (bool, optional) – If True, give verbose response. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

Wallet statistical information.

Return type:

WalletStatsModel

Raises:

APIError – Error thrown by node API. See message for details.

split_coins(wallet_name: str, wallet_password: str, total_amount_to_split: Money | int | float | Decimal, utxos_count: int, account_name: str = 'account 0', **kwargs) WalletSendTransactionModel

Creates requested amount of UTXOs each of equal value and sends the transaction.

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • wallet_password (str) – The wallet password.

  • total_amount_to_split (Money, int, float, Decimal) – The total amount to split.

  • utxos_count (int) – The number of utxos to create. (Must be greater than 2).

  • **kwargs – Extra keyword arguments.

Returns:

Information about the sent transaction.

Return type:

WalletSendTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

distribute_utxos(wallet_name: str, wallet_password: str, utxos_count: int, utxo_per_transaction: int, outpoints: List[Outpoint], account_name: str = 'account 0', use_unique_address_per_utxo: bool = True, reuse_addresses: bool = True, use_change_addresses: bool = False, timestamp_difference_between_transactions: int = 0, min_confirmations: int = 0, dry_run: bool = True, **kwargs) DistributeUtxoModel

Splits and distributes UTXOs across wallet addresses

Parameters:
  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • wallet_password (str) – The wallet password.

  • use_unique_address_per_utxo (bool, optional) – If True, uses a unique address for each utxo. Default=True.

  • reuse_addresses (bool, optional) – If True, reuses addresses. Default=True.

  • use_change_addresses (bool, optional) – If True, use change addresses. Default=False.

  • utxos_count (int) – The number of utxos to create.

  • utxo_per_transaction (int) – The number of utxos per transaction.

  • timestamp_difference_between_transactions (int, optional) – The number of seconds between transactions. Default=0.

  • min_confirmations (int, optional) – The minimum number of confirmations to include in transaction. Default=0.

  • outpoints (List[Outpoint]) – A list of outpoints to include in the transaction.

  • dry_run (bool, optional) – If True, simulate transaction. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

Information about the distribute utxo transaction.

Return type:

DistributeUtxoModel

Raises:

APIError – Error thrown by node API. See message for details.

sweep(private_keys: List[Key | str], destination_address: Address | str, broadcast: bool = False, **kwargs) List[uint256]

Sweeps a wallet to specified address.

Parameters:
  • private_keys (List[Key, str]) – A list of private keys to sweep.

  • destination_address (Address, str) – The address to sweep the coins to.

  • broadcast (bool, optional) – Broadcast transaction after creation. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

A list of transactions for the sweep.

Return type:

List[uint256]

Raises:

APIError – Error thrown by node API. See message for details.

build_offline_sign_request(wallet_name: str, outpoints: List[Outpoint], recipients: List[Recipient], fee_amount: Money | int | float | Decimal | None = None, op_return_data: str | None = None, op_return_amount: Money | int | float | Decimal | None = None, fee_type: str | None = None, allow_unconfirmed: bool = False, shuffle_outputs: bool = False, account_name: str = 'account 0', change_address: Address | str | None = None, **kwargs) BuildOfflineSignModel

Builds an offline sign request for a transaction.

Parameters:
  • fee_amount (Money, int, float, Decimal) – The fee amount. Cannot be set with fee_type.

  • wallet_name (str) – The wallet name.

  • account_name (str, optional) – The account name. Default=’account 0’.

  • outpoints (List[Outpoint]) – A list of outputs to use for the transaction.

  • recipients (List[Recipient]) – A list of recipients, including amounts.

  • op_return_data (str, optional) – The OP_RETURN data.

  • op_return_amount (Money, optional) – The amount to burn in OP_RETURN.

  • fee_type (str, optional) – The fee type. Allowed [low, medium, high]

  • allow_unconfirmed (bool, optional) – If True, includes unconfirmed outputs. Default=False.

  • shuffle_outputs (bool, optional) – If True, shuffle outputs. Default=False.

  • change_address (Address, optional) – Specify a change address. If not set, a new change address is used.

  • **kwargs – Extra keyword arguments.

Returns:

A built transaction that can be signed offline.

Return type:

BuildOfflineSignModel

Raises:

APIError – Error thrown by node API. See message for details.

offline_sign_request(wallet_password: str, wallet_name: str, unsigned_transaction: str | hexstr, fee: Money | int | float | Decimal, utxos: List[UtxoDescriptor], addresses: List[AddressDescriptor], wallet_account: str = 'account 0', **kwargs) BuildTransactionModel

Build an offline sign request for a transaction. The resulting transaction hex can be broadcast.

Parameters:
  • wallet_password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • wallet_account (str, optional) – The account name. Default=’account 0’.

  • unsigned_transaction (hexstr, str) – The unsigned transaction hexstr.

  • fee (Money, int, float, Decimal) – The fee.

  • utxos (List[UtxoDescriptor]) – A list of utxodescriptors.

  • addresses (List[AddressDescriptor]) – A list of addresses to send transactions.

  • **kwargs – Extra keyword arguments.

Returns:

A signed transaction that can be broadcast.

Return type:

BuildTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

consolidate(wallet_password: str, wallet_name: str, destination_address: Address | str, utxo_value_threshold_in_satoshis: int, wallet_account: str = 'account 0', broadcast: bool = False, **kwargs) hexstr

Consolidate a wallet.

utxo_value_threshold looks to consolidate any utxo amount below the threshold.

Parameters:
  • wallet_password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • wallet_account (str, optional) – The account name. Default=’account 0’.

  • destination_address (Address, str) – The destination address.

  • utxo_value_threshold_in_satoshis (int) – The threshold where amounts below this amount will be consolidated. (min 1e8)

  • broadcast (bool, optional) – If True, broadcast consolidation transaction. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

A consolidation transaction ready for broadcast.

Return type:

hexstr

Raises:

APIError – Error thrown by node API. See message for details.

AccountHistoryModel

class AccountHistoryModel(*, accountName: str, accountHdPath: str, coinType: CoinType, transactionsHistory: List[TransactionItemModel])

An pydantic model for account history.

account_name: str

The account name.

account_hd_path: str

The account HD path.

coin_type: CoinType

The coin type.

transactions_history: List[TransactionItemModel]

A list of transactions composing the history.

AddressBalanceModel

class AddressBalanceModel(*, address: Address, coinType: CoinType, amountConfirmed: Money, amountUnconfirmed: Money, spendableAmount: Money)

A pydantic model for an address balance.

address: Address

The address.

coin_type: CoinType

The coin type.

amount_confirmed: Money

The confirmed amount.

amount_unconfirmed: Money

The unconfirmed amount.

spendable_amount: Money

The spendable amount.

AddressesModel

class AddressesModel(*, addresses: List[AddressModel])

A pydantic model for a list of addressmodels.

addresses: List[AddressModel]

The list of address models.

BuildOfflineSignModel

class BuildOfflineSignModel(*, walletName: str, walletAccount: str, unsignedTransaction: hexstr, fee: Money, utxos: List[UtxoDescriptor], addresses: List[AddressDescriptor])

A pydantic model for a built offline sign request.

wallet_name: str

The wallet name.

wallet_account: str

The wallet account.

unsigned_transaction: hexstr

The unsigned transaction hex.

fee: Money

The transaction fee.

utxos: List[UtxoDescriptor]

The utxos included in the transaction.

addresses: List[AddressDescriptor]

The addresses and amounts receiving outputs.

BuildTransactionModel

class BuildTransactionModel(*, fee: Money = 0, hex: hexstr, transactionId: uint256)

A pydantic model for a built transaction.

fee: Money

The transaction fee.

hex: hexstr

The transaction hex.

transaction_id: uint256

The transaction hash.

DistributeUtxoModel

class DistributeUtxoModel(*, walletName: str, useUniqueAddressPerUtxo: bool, utxosCount: int, utxoPerTransaction: int, timestampDifferenceBetweenTransactions: int, minConfirmations: int, dryRun: bool, walletSendTransaction: List[WalletSendTransactionModel] = None)

A pydantic model for the distribute utxo method.

wallet_name: str

The wallet name.

use_unique_address_per_utxo: bool

If true, a different address used for each utxo.

utxos_count: int

The number of utxos.

utxo_per_transaction: int

The number of utxos per transaction.

timestamp_difference_between_transactions: int

The number of seconds between transactions.

min_confirmations: int

The minimum number of confirmations to include utxo in transaction.

dry_run: bool

If true, simulate the transaction.

wallet_send_transaction: List[WalletSendTransactionModel] | None

A list of send transactions (if not simulated).

MaxSpendableAmountModel

class MaxSpendableAmountModel(*, maxSpendableAmount: Money, Fee: Money)

A pydantic model for the maximum spendable amount.

max_spendable_amount: Money

The maximum spendable amount.

fee: Money

The to spend the maximum amount.

PaymentDetailModel

class PaymentDetailModel(*, destinationAddress: Address, amount: Money, isChange: bool)

A pydantic model for payment details.

destination_address: Address

The destination address.

amount: Money

The amount sent to this address.

is_change: bool

If true, destination address is a change address.

RemovedTransactionModel

class RemovedTransactionModel(*, transactionId: uint256, creationTime: datetime)

A pydantic model for a removed transaction.

transaction_id: uint256

The removed transaction hash.

creation_time: datetime

The creation time of the removed transaction.

SpendableTransactionModel

class SpendableTransactionModel(*, id: uint256, index: int, address: Address, isChange: bool, amount: Money, creationTime: datetime, confirmations: int)

A pydantic model representing spendable transactions.

transaction_id: uint256

The transaction hash with spendable output.

index: int

The index of the spendable output.

address: Address

The address holding the spendable output.

is_change: bool

If true, address is a change address.

amount: Money

The amount in the unspent output.

creation_time: datetime

The output creation time.

confirmations: int

The number of confirmations for three output.

SpendableTransactionsModel

class SpendableTransactionsModel(*, transactions: List[SpendableTransactionModel])

A pydantic model for a list of spendable transactions.

transactions: List[SpendableTransactionModel]

A list of spendable transactions.

TransactionItemModel

class TransactionItemModel(*, type: TransactionItemType, toAddress: Address, id: uint256, amount: Money, payments: List[PaymentDetailModel] = None, fee: Money = None, confirmedInBlock: int, timestamp: datetime, txOutputTime: datetime, txOutputIndex: int, blockIndex: int = None)

A pydantic model for a transaction item.

transaction_type: TransactionItemType

The transaction type.

to_address: Address

The address receiving the transaction.

transaction_id: uint256

The transaction hash.

amount: Money

The transaction value.

payments: List[PaymentDetailModel] | None

A list of payment detail models.

fee: Money | None

The transaction fee.

confirmed_in_block: int

The block n height where transaction was confirmed.

timestamp: datetime

The transaction timestamp.

tx_output_time: datetime

The transaction output time.

tx_output_index: int

The transaction output index.

block_index: int | None

The block index.

TransactionOutputModel

class TransactionOutputModel(*, address: int | Address | None = None, amount: Money, opReturnData: str = None)

A pydantic model of a transaction output.

address: int | Address | None

The address receiving the output.

amount: Money

The output amount.

op_return_data: str | None

The OP_RETURN data, if present.

UtxoAmountModel

class UtxoAmountModel(*, Amount: Money, Count: int)

A pydantic model representing a utxo amount.

amount: Money

The total amount in the utxos.

count: int

The number of utxos included in the count.

UtxoPerBlockModel

class UtxoPerBlockModel(*, utxoPerBlock: int, Count: int)

A pydantic model representing utxo per block.

utxo_per_block: int

The number of utxo per block.

count: int

The number of utxos.

UtxoPerTransactionModel

class UtxoPerTransactionModel(*, utxoPerTransaction: int, Count: int)

A pydantic model for utxo per transaction.

utxo_per_transaction: int

The utxo per transaction.

count: int

The total number of utxos.

WalletHistoryModel

class WalletHistoryModel(*, History: List[AccountHistoryModel])

A pydantic model for a wallet history.

history: List[AccountHistoryModel]

A list of account histories.

WalletStatsModel

class WalletStatsModel(*, walletName: str, totalUtxoCount: int, uniqueTransactionCount: int, uniqueBlockCount: int, countOfTransactionsWithAtLeastMaxReorgConfirmations: int, utxoAmounts: List[UtxoAmountModel], utxoPerTransaction: List[UtxoPerTransactionModel], utxoPerBlock: List[UtxoPerBlockModel])

A pydantic model for wallet stats.

wallet_name: str

The wallet name.

total_utxo_count: int

The total number of utxos.

unique_transaction_count: int

The number of unique transactions.

unique_block_count: int

The number of unique blocks containing wallet transactions.

finalized_transactions: int

The number of finalized transactions.

utxo_amounts: List[UtxoAmountModel]

A list of utxo amounts.

utxo_per_transaction: List[UtxoPerTransactionModel]

A list of utxo per transaction.

utxo_per_block: List[UtxoPerBlockModel]

A list of utxo per block.

WalletBalanceModel

class WalletBalanceModel(*, balances: List[AccountBalanceModel])

A pydantic model for a wallet balance.

balances: List[AccountBalanceModel]

A list of account balances.

WalletGeneralInfoModel

class WalletGeneralInfoModel(*, walletName: str = None, network: str, creationTime: datetime, isDecrypted: bool, lastBlockSyncedHeight: int, chainTip: int, isChainSynced: bool, connectedNodes: int)

A model representing general wallet info.

wallet_name: str | None

The name of the wallet. Will be None for multisig.

network: str

The name of the network the wallet is operating on.

creation_time: datetime

The datetime of wallet creation

is_decrypted: bool

If true, wallet is decrypted.

last_block_synced_height: int

The height of last block synced by wallet.

chain_tip: int

The height off the chain tip.

is_chain_synced: bool

If true, chain is synced.

connected_nodes: int

The number of connected nodes.

WalletSendTransactionModel

class WalletSendTransactionModel(*, transactionId: uint256, outputs: List[TransactionOutputModel])

A pydantic model for a send transaction response.

transaction_id: uint256

The transaction hash.

outputs: List[TransactionOutputModel]

A list of transaction outputs.