Skip to content

aea.helpers.transaction.base

This module contains terms related classes.

RawTransaction Objects

class RawTransaction()

This class represents an instance of RawTransaction.

__init__

 | __init__(ledger_id: str, body: JSONLike) -> None

Initialise an instance of RawTransaction.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> JSONLike

Get the body.

encode

 | @staticmethod
 | encode(raw_transaction_protobuf_object: Any, raw_transaction_object: "RawTransaction") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the raw_transaction_protobuf_object argument must be matched with the instance of this class in the 'raw_transaction_object' argument.

Arguments:

  • raw_transaction_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • raw_transaction_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, raw_transaction_protobuf_object: Any) -> "RawTransaction"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'raw_transaction_protobuf_object' argument.

Arguments:

  • raw_transaction_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'raw_transaction_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

RawMessage Objects

class RawMessage()

This class represents an instance of RawMessage.

__init__

 | __init__(ledger_id: str, body: bytes, is_deprecated_mode: bool = False) -> None

Initialise an instance of RawMessage.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> bytes

Get the body.

is_deprecated_mode

 | @property
 | is_deprecated_mode() -> bool

Get the is_deprecated_mode.

encode

 | @staticmethod
 | encode(raw_message_protobuf_object: Any, raw_message_object: "RawMessage") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the raw_message_protobuf_object argument must be matched with the instance of this class in the 'raw_message_object' argument.

Arguments:

  • raw_message_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • raw_message_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, raw_message_protobuf_object: Any) -> "RawMessage"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'raw_message_protobuf_object' argument.

Arguments:

  • raw_message_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'raw_message_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

SignedTransaction Objects

class SignedTransaction()

This class represents an instance of SignedTransaction.

__init__

 | __init__(ledger_id: str, body: JSONLike) -> None

Initialise an instance of SignedTransaction.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> JSONLike

Get the body.

encode

 | @staticmethod
 | encode(signed_transaction_protobuf_object: Any, signed_transaction_object: "SignedTransaction") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the signed_transaction_protobuf_object argument must be matched with the instance of this class in the 'signed_transaction_object' argument.

Arguments:

  • signed_transaction_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • signed_transaction_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, signed_transaction_protobuf_object: Any) -> "SignedTransaction"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'signed_transaction_protobuf_object' argument.

Arguments:

  • signed_transaction_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'signed_transaction_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

SignedMessage Objects

class SignedMessage()

This class represents an instance of RawMessage.

__init__

 | __init__(ledger_id: str, body: str, is_deprecated_mode: bool = False) -> None

Initialise an instance of SignedMessage.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> str

Get the body.

is_deprecated_mode

 | @property
 | is_deprecated_mode() -> bool

Get the is_deprecated_mode.

encode

 | @staticmethod
 | encode(signed_message_protobuf_object: Any, signed_message_object: "SignedMessage") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the signed_message_protobuf_object argument must be matched with the instance of this class in the 'signed_message_object' argument.

Arguments:

  • signed_message_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • signed_message_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, signed_message_protobuf_object: Any) -> "SignedMessage"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'signed_message_protobuf_object' argument.

Arguments:

  • signed_message_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'signed_message_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

State Objects

class State()

This class represents an instance of State.

__init__

 | __init__(ledger_id: str, body: JSONLike) -> None

Initialise an instance of State.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> JSONLike

Get the body.

encode

 | @staticmethod
 | encode(state_protobuf_object: Any, state_object: "State") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the state_protobuf_object argument must be matched with the instance of this class in the 'state_object' argument.

Arguments:

  • state_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • state_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, state_protobuf_object: Any) -> "State"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'state_protobuf_object' argument.

Arguments:

  • state_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'state_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

Terms Objects

class Terms()

Class to represent the terms of a multi-currency & multi-token ledger transaction.

__init__

 | __init__(ledger_id: str, sender_address: Address, counterparty_address: Address, amount_by_currency_id: Dict[str, int], quantities_by_good_id: Dict[str, int], nonce: str, is_sender_payable_tx_fee: bool = True, fee_by_currency_id: Optional[Dict[str, int]] = None, is_strict: bool = False, **kwargs: Any, ,) -> None

Instantiate terms of a transaction.

Arguments:

  • ledger_id: the ledger on which the terms are to be settled.
  • sender_address: the sender address of the transaction.
  • counterparty_address: the counterparty address of the transaction.
  • amount_by_currency_id: the amount by the currency of the transaction.
  • quantities_by_good_id: a map from good id to the quantity of that good involved in the transaction.
  • nonce: nonce to be included in transaction to discriminate otherwise identical transactions.
  • is_sender_payable_tx_fee: whether the sender or counterparty pays the tx fee.
  • fee_by_currency_id: the fee associated with the transaction.
  • is_strict: whether or not terms must have quantities and amounts of opposite signs.
  • kwargs: keyword arguments

id

 | @property
 | id() -> str

Get hash of the terms.

sender_hash

 | @property
 | sender_hash() -> str

Get the sender hash.

counterparty_hash

 | @property
 | counterparty_hash() -> str

Get the sender hash.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

sender_address

 | @property
 | sender_address() -> Address

Get the sender address.

counterparty_address

 | @property
 | counterparty_address() -> Address

Get the counterparty address.

counterparty_address

 | @counterparty_address.setter
 | counterparty_address(counterparty_address: Address) -> None

Set the counterparty address.

amount_by_currency_id

 | @property
 | amount_by_currency_id() -> Dict[str, int]

Get the amount by currency id.

is_sender_payable_tx_fee

 | @property
 | is_sender_payable_tx_fee() -> bool

Bool indicating whether the tx fee is paid by sender or counterparty.

is_single_currency

 | @property
 | is_single_currency() -> bool

Check whether a single currency is used for payment.

is_empty_currency

 | @property
 | is_empty_currency() -> bool

Check whether a single currency is used for payment.

currency_id

 | @property
 | currency_id() -> str

Get the amount the sender must pay.

sender_payable_amount

 | @property
 | sender_payable_amount() -> int

Get the amount the sender must pay.

sender_payable_amount_incl_fee

 | @property
 | sender_payable_amount_incl_fee() -> int

Get the amount the sender must pay inclusive fee.

counterparty_payable_amount

 | @property
 | counterparty_payable_amount() -> int

Get the amount the counterparty must pay.

counterparty_payable_amount_incl_fee

 | @property
 | counterparty_payable_amount_incl_fee() -> int

Get the amount the counterparty must pay.

quantities_by_good_id

 | @property
 | quantities_by_good_id() -> Dict[str, int]

Get the quantities by good id.

good_ids

 | @property
 | good_ids() -> List[str]

Get the (ordered) good ids.

sender_supplied_quantities

 | @property
 | sender_supplied_quantities() -> List[int]

Get the (ordered) quantities supplied by the sender.

counterparty_supplied_quantities

 | @property
 | counterparty_supplied_quantities() -> List[int]

Get the (ordered) quantities supplied by the counterparty.

nonce

 | @property
 | nonce() -> str

Get the nonce.

has_fee

 | @property
 | has_fee() -> bool

Check if fee is set.

fee

 | @property
 | fee() -> int

Get the fee.

sender_fee

 | @property
 | sender_fee() -> int

Get the sender fee.

counterparty_fee

 | @property
 | counterparty_fee() -> int

Get the counterparty fee.

fee_by_currency_id

 | @property
 | fee_by_currency_id() -> Dict[str, int]

Get fee by currency.

kwargs

 | @property
 | kwargs() -> JSONLike

Get the kwargs.

is_strict

 | @property
 | is_strict() -> bool

Get is_strict.

get_hash

 | @staticmethod
 | get_hash(ledger_id: str, sender_address: str, counterparty_address: str, good_ids: List[str], sender_supplied_quantities: List[int], counterparty_supplied_quantities: List[int], sender_payable_amount: int, counterparty_payable_amount: int, nonce: str) -> str

Generate a hash from transaction information.

Arguments:

  • ledger_id: the ledger id
  • sender_address: the sender address
  • counterparty_address: the counterparty address
  • good_ids: the list of good ids
  • sender_supplied_quantities: the quantities supplied by the sender (must all be positive)
  • counterparty_supplied_quantities: the quantities supplied by the counterparty (must all be positive)
  • sender_payable_amount: the amount payable by the sender
  • counterparty_payable_amount: the amount payable by the counterparty
  • nonce: the nonce of the transaction

Returns:

the hash

encode

 | @staticmethod
 | encode(terms_protobuf_object: Any, terms_object: "Terms") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the terms_protobuf_object argument must be matched with the instance of this class in the 'terms_object' argument.

Arguments:

  • terms_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • terms_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, terms_protobuf_object: Any) -> "Terms"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'terms_protobuf_object' argument.

Arguments:

  • terms_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'terms_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

TransactionDigest Objects

class TransactionDigest()

This class represents an instance of TransactionDigest.

__init__

 | __init__(ledger_id: str, body: str) -> None

Initialise an instance of TransactionDigest.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

body

 | @property
 | body() -> str

Get the receipt.

encode

 | @staticmethod
 | encode(transaction_digest_protobuf_object: Any, transaction_digest_object: "TransactionDigest") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the transaction_digest_protobuf_object argument must be matched with the instance of this class in the 'transaction_digest_object' argument.

Arguments:

  • transaction_digest_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • transaction_digest_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, transaction_digest_protobuf_object: Any) -> "TransactionDigest"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'transaction_digest_protobuf_object' argument.

Arguments:

  • transaction_digest_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'transaction_digest_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

TransactionReceipt Objects

class TransactionReceipt()

This class represents an instance of TransactionReceipt.

__init__

 | __init__(ledger_id: str, receipt: JSONLike, transaction: JSONLike) -> None

Initialise an instance of TransactionReceipt.

ledger_id

 | @property
 | ledger_id() -> str

Get the id of the ledger on which the terms are to be settled.

receipt

 | @property
 | receipt() -> JSONLike

Get the receipt.

transaction

 | @property
 | transaction() -> JSONLike

Get the transaction.

encode

 | @staticmethod
 | encode(transaction_receipt_protobuf_object: Any, transaction_receipt_object: "TransactionReceipt") -> None

Encode an instance of this class into the protocol buffer object.

The protocol buffer object in the transaction_receipt_protobuf_object argument must be matched with the instance of this class in the 'transaction_receipt_object' argument.

Arguments:

  • transaction_receipt_protobuf_object: the protocol buffer object whose type corresponds with this class.
  • transaction_receipt_object: an instance of this class to be encoded in the protocol buffer object.

decode

 | @classmethod
 | decode(cls, transaction_receipt_protobuf_object: Any) -> "TransactionReceipt"

Decode a protocol buffer object that corresponds with this class into an instance of this class.

A new instance of this class must be created that matches the protocol buffer object in the 'transaction_receipt_protobuf_object' argument.

Arguments:

  • transaction_receipt_protobuf_object: the protocol buffer object whose type corresponds with this class.

Returns:

A new instance of this class that matches the protocol buffer object in the 'transaction_receipt_protobuf_object' argument.

__eq__

 | __eq__(other: Any) -> bool

Check equality.

__str__

 | __str__() -> str

Get string representation.

Back to top