ColdStaking

ColdStaking

class ColdStaking(**kwargs)

Implements the coldstaking api endpoints.

account(wallet_name: str, wallet_password: str, is_cold_wallet_account: bool = False, extpubkey: Union[pystratis.core.extpubkey.ExtPubKey, str] = None, **kwargs) → pystratis.api.coldstaking.responsemodels.accountmodel.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) → pystratis.api.coldstaking.responsemodels.addressmodel.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.

estimate_offline_setup_tx_fee(cold_wallet_address: Union[pystratis.core.types.address.Address, str], hot_wallet_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_account: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) → pystratis.core.types.money.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.

estimate_offline_withdrawal_tx_fee(wallet_name: str, account_name: str, receiving_address: Union[pystratis.core.types.address.Address, str], amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, **kwargs) → pystratis.core.types.money.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_setup_tx_fee(cold_wallet_address: Union[pystratis.core.types.address.Address, str], hot_wallet_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_account: str, wallet_password: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) → pystratis.core.types.money.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_withdrawal_tx_fee(receiving_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_password: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, **kwargs) → pystratis.core.types.money.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.

info(wallet_name: str, **kwargs) → pystratis.api.coldstaking.responsemodels.infomodel.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.

offline_withdrawal(receiving_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, account_name: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, **kwargs) → pystratis.api.global_responsemodels.buildofflinesignmodel.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.

setup(cold_wallet_address: Union[pystratis.core.types.address.Address, str], hot_wallet_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_account: str, wallet_password: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) → pystratis.api.coldstaking.responsemodels.setupmodel.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: Union[pystratis.core.types.address.Address, str], hot_wallet_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_account: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, split_count: int = 1, segwit_change_address: bool = False, **kwargs) → pystratis.api.global_responsemodels.buildofflinesignmodel.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.

withdrawal(receiving_address: Union[pystratis.core.types.address.Address, str], wallet_name: str, wallet_password: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], fees: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], subtract_fee_from_amount: bool = True, **kwargs) → pystratis.api.coldstaking.responsemodels.withdrawalmodel.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.

AccountModel

class AccountModel

A pydantic model for a cold staking account.

AddressModel

class AddressModel

A pydantic model for a cold staking address.

BuildOfflineSignModel

class BuildOfflineSignModel

A pydantic model for a built offline sign request.

InfoModel

class InfoModel

A pydantic model for cold wallet information.

SetupModel

class SetupModel

A pydantic model for a cold staking wallet setup transaction.

WithdrawalModel

class WithdrawalModel

A pydantic model for a cold staking withdrawal transaction.