helium_py.transactions.transaction.Transaction

class helium_py.transactions.transaction.Transaction(*, owner: Optional[Address] = None, owner_signature: Optional[bytes] = None, stake_amount: Optional[int] = None, stake_release_height: Optional[int] = None, fee: Optional[int] = None)[source]

Bases: object

Base Transaction Class.

__init__(*, owner: Optional[Address] = None, owner_signature: Optional[bytes] = None, stake_amount: Optional[int] = None, stake_release_height: Optional[int] = None, fee: Optional[int] = None)[source]

Initialize a new Transaction instance.

Methods

__init__(*[, owner, owner_signature, ...])

Initialize a new Transaction instance.

calculate_fee(**init_kwargs)

Return fee for transaction based on payload size and chain variables.

config([transaction_fee_multiplier, ...])

Optionally update and return configuration values for chain variables.

deserialize(serialized_transaction)

Return a Transaction instance from the provided serialized transaction bytes.

fetch_config()

Update chain variables via API and return configuration values for chain variables.

from_b64(serialized_transaction)

Return a Transaction instance from the provided base64 bytes.

get_addresses()

Return addresses for protocol buffer initialization.

get_calculate_fee_kwargs()

Return kwargs to use for calculating fee.

get_deserialized_addresses(proto_model)

Return all deserialized Address instances for Transaction instances address fields.

get_deserialized_integers(proto_model)

Return deserialized integers.

get_deserialized_payment_lists(proto_model)

Return deserialized payment lists.

get_deserialized_signatures(proto_model)

Return deserialized signatures.

get_deserialized_strings(proto_model)

Return deserialized strings.

get_integers()

Return integers for protocol buffer initialization.

get_payment_lists()

Return payment lists for protocol buffer initialization.

get_signatures([for_signing])

Return signatures for protocol buffer initialization.

get_strings()

Return strings for protocol buffer initialization.

getattr_none(obj, attr)

getattr() but return None for any attr that is empty bytes.

orig_kwarg_gt0_or_none(key)

Return the original kwarg value if greater than zero and not None.

serialize()

Return the bytes representation of a Transaction instance.

sign()

Sign a Transaction instance using available keypairs.

string_type(transaction_string)

Return the protocol buffer string type of the Transaction instance from bytes repr.

to_b64()

Return base64 encoded byte value for serialized protocol buffer data.

to_proto([for_signing])

Return a protocol buffer BlockchainTxn instance from this Transaction instance.

Attributes

calculated_fee

Property for calculated fee for Transaction in current state.

dc_payload_size

staking_fee_txn_add_gateway_v1

staking_fee_txn_assert_location_v1

transaction_fee_multiplier

type

fields

defaults

keypairs

proto_model_class

proto_txn_field

classmethod calculate_fee(**init_kwargs: dict) int[source]

Return fee for transaction based on payload size and chain variables.

property calculated_fee: int

Property for calculated fee for Transaction in current state.

classmethod config(transaction_fee_multiplier: Optional[int] = None, dc_payload_size: Optional[int] = None, staking_fee_txn_assert_location_v1: Optional[int] = None, staking_fee_txn_add_gateway_v1: Optional[int] = None) Dict[str, int][source]

Optionally update and return configuration values for chain variables.

classmethod deserialize(serialized_transaction: bytes) Transaction[source]

Return a Transaction instance from the provided serialized transaction bytes.

classmethod fetch_config()[source]

Update chain variables via API and return configuration values for chain variables.

classmethod from_b64(serialized_transaction: bytes) Transaction[source]

Return a Transaction instance from the provided base64 bytes.

get_addresses()[source]

Return addresses for protocol buffer initialization.

get_calculate_fee_kwargs() dict[source]

Return kwargs to use for calculating fee.

classmethod get_deserialized_addresses(proto_model: Message) Dict[str, Optional[Address]][source]

Return all deserialized Address instances for Transaction instances address fields.

classmethod get_deserialized_integers(proto_model: Message) Dict[str, int][source]

Return deserialized integers.

classmethod get_deserialized_payment_lists(proto_model: Message) Dict[str, List[Payment]][source]

Return deserialized payment lists.

classmethod get_deserialized_signatures(proto_model: Message) Dict[str, bytes][source]

Return deserialized signatures.

classmethod get_deserialized_strings(proto_model: Message) Dict[str, str][source]

Return deserialized strings.

get_integers()[source]

Return integers for protocol buffer initialization.

get_payment_lists()[source]

Return payment lists for protocol buffer initialization.

get_signatures(for_signing: bool = False)[source]

Return signatures for protocol buffer initialization.

get_strings()[source]

Return strings for protocol buffer initialization.

static getattr_none(obj: Any, attr: str) Any[source]

getattr() but return None for any attr that is empty bytes.

orig_kwarg_gt0_or_none(key) Optional[int][source]

Return the original kwarg value if greater than zero and not None.

payment_class

alias of Payment

serialize() bytes[source]

Return the bytes representation of a Transaction instance.

sign() Transaction[source]

Sign a Transaction instance using available keypairs.

static string_type(transaction_string: bytes) str[source]

Return the protocol buffer string type of the Transaction instance from bytes repr.

to_b64() bytes[source]

Return base64 encoded byte value for serialized protocol buffer data.

to_proto(for_signing: bool = False) Message[source]

Return a protocol buffer BlockchainTxn instance from this Transaction instance.