From 3852972730139ff15b8553acf33d557f633b0eab Mon Sep 17 00:00:00 2001 From: Peter Lodri Date: Thu, 28 Sep 2017 11:28:39 +0200 Subject: [PATCH 1/2] Transfer class to follow naming conventions of other libs --- iota/transaction/creation.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/iota/transaction/creation.py b/iota/transaction/creation.py index c0875fe2..cf0c0b99 100644 --- a/iota/transaction/creation.py +++ b/iota/transaction/creation.py @@ -80,6 +80,42 @@ def as_tryte_string(self): return super(ProposedTransaction, self).as_tryte_string() +class Transfer(ProposedTransaction): + """ + Follow naming convention of other libs. + A transaction that has not yet been attached to the Tangle. + + Provide to :py:meth:`iota.api.Iota.send_transfer` to attach to + tangle and publish/store. + """ + def __init__(self, address, value, tag=None, message=None, timestamp=None): + # type: (Address, int, Optional[Tag], Optional[TryteString], Optional[int]) -> None + if not timestamp: + timestamp = get_current_timestamp() + + super(ProposedTransaction, self).__init__( + address = address, + tag = Tag(b'') if tag is None else tag, + timestamp = timestamp, + value = value, + + # These values will be populated when the bundle is finalized. + bundle_hash = None, + current_index = None, + hash_ = None, + last_index = None, + signature_message_fragment = None, + + # These values start out empty; they will be populated when the + # node does PoW. + branch_transaction_hash = TransactionHash(b''), + nonce = Hash(b''), + trunk_transaction_hash = TransactionHash(b''), + ) + + self.message = TryteString(b'') if message is None else message + + class ProposedBundle(Bundle, Sequence[ProposedTransaction]): """ A collection of proposed transactions, to be treated as an atomic From fab766106d399c3103cc4d960b538b4ddb5dd001 Mon Sep 17 00:00:00 2001 From: szepnapot Date: Sat, 30 Sep 2017 12:52:53 +0200 Subject: [PATCH 2/2] make Transfer an alias of ProposedTransaction --- iota/transaction/creation.py | 40 ++++++------------------------------ 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/iota/transaction/creation.py b/iota/transaction/creation.py index cf0c0b99..841bf62a 100644 --- a/iota/transaction/creation.py +++ b/iota/transaction/creation.py @@ -20,6 +20,7 @@ __all__ = [ 'ProposedBundle', 'ProposedTransaction', + 'Transfer', ] @@ -80,40 +81,11 @@ def as_tryte_string(self): return super(ProposedTransaction, self).as_tryte_string() -class Transfer(ProposedTransaction): - """ - Follow naming convention of other libs. - A transaction that has not yet been attached to the Tangle. - - Provide to :py:meth:`iota.api.Iota.send_transfer` to attach to - tangle and publish/store. - """ - def __init__(self, address, value, tag=None, message=None, timestamp=None): - # type: (Address, int, Optional[Tag], Optional[TryteString], Optional[int]) -> None - if not timestamp: - timestamp = get_current_timestamp() - - super(ProposedTransaction, self).__init__( - address = address, - tag = Tag(b'') if tag is None else tag, - timestamp = timestamp, - value = value, - - # These values will be populated when the bundle is finalized. - bundle_hash = None, - current_index = None, - hash_ = None, - last_index = None, - signature_message_fragment = None, - - # These values start out empty; they will be populated when the - # node does PoW. - branch_transaction_hash = TransactionHash(b''), - nonce = Hash(b''), - trunk_transaction_hash = TransactionHash(b''), - ) - - self.message = TryteString(b'') if message is None else message +Transfer = ProposedTransaction +""" +Follow naming convention of other libs. +https://github.com/iotaledger/iota.lib.py/issues/72 +""" class ProposedBundle(Bundle, Sequence[ProposedTransaction]):