ColdStaking

ColdStaking

class ColdStaking(**kwargs)

Implements the coldstaking api endpoints.

info(wallet_name: str, **kwargs) InfoModel

Gets general information related to cold staking.

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

  • **kwargs – Extra keyword arguments.

Returns:

The cold staking account information for the given wallet.

Return type:

InfoModel

Raises:

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

account(wallet_name: str, wallet_password: str, is_cold_wallet_account: bool = False, extpubkey: ExtPubKey | str | None = None, **kwargs) AccountModel

Create a cold staking account.

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

  • wallet_password (str) – The wallet password.

  • is_cold_wallet_account (bool, optional) – If this account is for a cold wallet. Default=False.

  • extpubkey (ExtPubKey, str, optional) – The extpubkey for the cold wallet.

  • **kwargs – Extra keyword arguments.

Returns:

Information about the cold staking account.

Return type:

AccountModel

Raises:

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

address(wallet_name: str, is_cold_wallet_address: bool = False, segwit: bool = False, **kwargs) AddressModel

Gets a cold staking address.

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

  • is_cold_wallet_address (bool, optional) – If this address is for a cold wallet. Default=False.

  • segwit (bool, optional) – If this is a segwit address. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

Information about the cold staking address.

Return type:

AddressModel

Raises:

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

setup(cold_wallet_address: Address | str, hot_wallet_address: Address | str, wallet_name: str, wallet_account: str, wallet_password: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) SetupModel

Spends funds from a normal wallet addresses to the cold staking script.

Parameters:
  • cold_wallet_address (Address, str) – The cold wallet address.

  • hot_wallet_address (Address, str) – The hot wallet address.

  • wallet_name (str) – The wallet name.

  • wallet_account (str) – The wallet account.

  • wallet_password (str) – The wallet password.

  • amount (Money, int, float, Decimal) – The amount to send to the old wallet.

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

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • split_count (int, optional) – Number of transactions to split over. Default=1.

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

  • **kwargs – Extra keyword arguments.

Returns:

The transaction hex for the cold staking setup transaction.

Return type:

SetupModel

Raises:

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

setup_offline(cold_wallet_address: Address | str, hot_wallet_address: Address | str, wallet_name: str, wallet_account: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) BuildOfflineSignModel

Creates a cold staking setup transaction in an unsigned state.

Parameters:
  • cold_wallet_address (Address, str) – The cold wallet address.

  • hot_wallet_address (Address, str) – The hot wallet address.

  • wallet_name (str) – The wallet name.

  • wallet_account (str) – The wallet account.

  • amount (Money, int, float, Decimal) – The amount to send to the old wallet.

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

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • split_count (int, optional) – Number of transactions to split over. Default=1.

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

  • **kwargs – Extra keyword arguments.

Returns:

The built transaction for signing offline.

Return type:

BuildOfflineSignModel

Raises:

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

estimate_setup_tx_fee(cold_wallet_address: Address | str, hot_wallet_address: Address | str, wallet_name: str, wallet_account: str, wallet_password: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) Money

Estimate the cold staking setup tx fee.

Parameters:
  • cold_wallet_address (Address, str) – The cold wallet address.

  • hot_wallet_address (Address, str) – The hot wallet address.

  • wallet_name (str) – The wallet name.

  • wallet_account (str) – The wallet account.

  • wallet_password (str) – The wallet password.

  • amount (Money, int, float, Decimal) – The amount to send to the old wallet.

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

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • split_count (int, optional) – Number of transactions to split over. Default=1.

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

  • **kwargs – Extra keyword arguments.

Returns:

The cold staking fee estimate.

Return type:

Money

Raises:

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

estimate_offline_setup_tx_fee(cold_wallet_address: Address | str, hot_wallet_address: Address | str, wallet_name: str, wallet_account: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) Money

Estimate the cold staking offline setup tx fee.

Parameters:
  • cold_wallet_address (Address, str) – The cold wallet address.

  • hot_wallet_address (Address, str) – The hot wallet address.

  • wallet_name (str) – The wallet name.

  • wallet_account (str) – The wallet account.

  • amount (Money, int, float, Decimal) – The amount to send to the old wallet.

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

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • split_count (int, optional) – Number of transactions to split over. Default=1.

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

  • **kwargs – Extra keyword arguments.

Returns:

The offline cold staking fee estimate.

Return type:

Money

Raises:

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

withdrawal(receiving_address: Address | str, wallet_name: str, wallet_password: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, **kwargs) WithdrawalModel

Spends funds from the cold staking wallet account back to a normal wallet account.

Parameters:
  • receiving_address (Address, str) – The receiving address.

  • wallet_password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • amount (Money, int, float, Decimal) – The amount to withdraw to the receiving address.

  • fees (Money, int, float, Decimal, optional) – The amount paid in fees.

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

The withdrawal transaction model.

Return type:

WithdrawalModel

Raises:

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

offline_withdrawal(receiving_address: Address | str, wallet_name: str, account_name: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, **kwargs) BuildOfflineSignModel

Builds a request to spend funds from a cold staking wallet account back to a normal wallet account.

Parameters:
  • receiving_address (Address, str) – The receiving address.

  • wallet_name (str) – The wallet name.

  • account_name (str) – The account name.

  • amount (Money, int, float, Decimal) – The amount to withdraw to the receiving address.

  • fees (Money, int, float, Decimal) – The amount paid in fees.

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

The built withdrawal transaction model for offline signing.

Return type:

BuildOfflineSignModel

Raises:

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

estimate_offline_withdrawal_tx_fee(wallet_name: str, account_name: str, receiving_address: Address | str, amount: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, **kwargs) Money

Estimate the fee for an offline cold staking withdrawal transaction.

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

  • account_name (str) – The account name.

  • receiving_address (Address, str) – The receiving address.

  • amount (Money, int, float, Decimal) – The amount to withdraw to the receiving address.

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

The estimate for offline withdrawal transaction fee.

Return type:

Money

Raises:

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

estimate_withdrawal_tx_fee(receiving_address: Address | str, wallet_name: str, wallet_password: str, amount: Money | int | float | Decimal, fees: Money | int | float | Decimal, subtract_fee_from_amount: bool = True, **kwargs) Money

Estimate the fee for a cold staking withdrawal transaction.

Parameters:
  • receiving_address (Address, str) – The receiving address.

  • wallet_password (str) – The wallet password.

  • wallet_name (str) – The wallet name.

  • amount (Money, int, float, Decimal) – The amount to withdraw to the receiving address.

  • fees (Money, int, float, Decimal, optional) – The amount paid in fees.

  • subtract_fee_from_amount (bool, optional) – If fee should be subtracted from amount. Default=True.

  • **kwargs – Extra keyword arguments.

Returns:

The estimate for the withdrawal transaction fee.

Return type:

Money

Raises:

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

retrieve_filtered_utxos(wallet_name: str, wallet_password: str, wallet_account: str, trx_hex: hexstr, broadcast: bool = False, **kwargs) List[hexstr]

Estimate the fee for a cold staking withdrawal transaction.

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

  • wallet_password (str) – The wallet password.

  • wallet_account (str) – The wallet account.

  • trx_hex (hexstr) – The transaction id hex.

  • broadcast (bool) – If true, broadcast the transaction to the network after being built. Default=False.

  • **kwargs – Extra keyword arguments.

Returns:

A list of hex encoded coldstaking transactions.

Return type:

List[hexstr]

Raises:

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

AccountModel

class AccountModel(*, accountName: str)

A pydantic model for a cold staking account.

account_name: str

The cold staking account name.

AddressModel

class AddressModel(*, address: Address)

A pydantic model for a cold staking address.

address: Address

The cold staking address.

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.

InfoModel

class InfoModel(*, coldWalletAccountExists: bool, hotWalletAccountExists: bool)

A pydantic model for cold wallet information.

cold_wallet_account_exists: bool

True if cold wallet account exists.

hot_wallet_account_exists: bool

True if hot wallet account exists.

SetupModel

class SetupModel(*, transactionHex: hexstr)

A pydantic model for a cold staking wallet setup transaction.

transaction_hex: hexstr

The hex serialized cold staking wallet setup transaction.

WithdrawalModel

class WithdrawalModel(*, transactionHex: hexstr)

A pydantic model for a cold staking withdrawal transaction.

transaction_hex: hexstr

A hex serialized cold staking wallet withdrawal transaction.