wownero-python/monero/transaction.py

46 lines
1.3 KiB
Python
Raw Normal View History

2017-12-27 00:49:59 +00:00
class Transaction(object):
hash = None
height = None
timestamp = None
fee = None
2018-01-22 02:55:08 +00:00
blob = None
2017-12-27 00:49:59 +00:00
def __init__(self, hash=None, **kwargs):
self.hash = hash
self.height = kwargs.get('height', self.height)
self.timestamp = kwargs.get('timestamp', self.timestamp)
self.fee = kwargs.get('fee', self.fee)
2018-01-22 02:55:08 +00:00
self.blob = kwargs.get('blob', self.blob)
2018-01-06 15:44:38 +00:00
def __repr__(self):
return self.hash
2017-12-27 00:49:59 +00:00
2018-01-22 02:55:08 +00:00
class LocalTransaction(Transaction):
"""A transaction that concerns local wallet, either incoming or outgoing."""
payment_id = None
amount = None
local_address = None
def __init__(self, **kwargs):
super(LocalTransaction, self).__init__(**kwargs)
self.payment_id = kwargs.get('payment_id', self.payment_id)
self.amount = kwargs.get('amount', self.amount)
self.local_address = kwargs.get('local_address', self.local_address)
class Payment(LocalTransaction):
2017-12-27 00:49:59 +00:00
"""Incoming Transaction"""
pass
2018-01-22 02:55:08 +00:00
class Transfer(LocalTransaction):
2017-12-27 00:49:59 +00:00
"""Outgoing Transaction"""
key = None
note = ''
def __init__(self, **kwargs):
super(Transfer, self).__init__(**kwargs)
self.key = kwargs.get('key', self.key)
self.note = kwargs.get('note', self.note)