Make list of destinations a tuple, like argument to transfer_multiple();
Initialize destinations as empty list, make iterations straightforward
This commit is contained in:
parent
55ce01f555
commit
2d9843fec9
|
@ -247,7 +247,7 @@ class JSONRPCWallet(object):
|
||||||
}
|
}
|
||||||
if 'destinations' in data:
|
if 'destinations' in data:
|
||||||
result['destinations'] = [
|
result['destinations'] = [
|
||||||
{'address': address(x['address']), 'amount': from_atomic(data['amount'])}
|
(address(x['address']), from_atomic(data['amount']))
|
||||||
for x in data.get('destinations')
|
for x in data.get('destinations')
|
||||||
]
|
]
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -50,7 +50,7 @@ class OutgoingPayment(Payment):
|
||||||
destinations = None
|
destinations = None
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.destinations = kwargs.pop('destinations', self.destinations)
|
self.destinations = kwargs.pop('destinations', [])
|
||||||
super(OutgoingPayment, self).__init__(**kwargs)
|
super(OutgoingPayment, self).__init__(**kwargs)
|
||||||
|
|
||||||
_reprstr = "out: {} @ {} {:.12f} id={}"
|
_reprstr = "out: {} @ {} {:.12f} id={}"
|
||||||
|
|
|
@ -33,14 +33,20 @@ _TXHDR = "timestamp height id/hash
|
||||||
" amount fee {dir:95s} payment_id"
|
" amount fee {dir:95s} payment_id"
|
||||||
|
|
||||||
def pmt2str(pmt):
|
def pmt2str(pmt):
|
||||||
return "{time} {height:7d} {hash} {amount:17.12f} {fee:13.12f} {addr} {payment_id}".format(
|
res = ["{time} {height:7d} {hash} {amount:17.12f} {fee:13.12f} {addr} {payment_id}".format(
|
||||||
time=pmt.timestamp.strftime("%d-%m-%y %H:%M:%S") if getattr(pmt, 'timestamp', None) else None,
|
time=pmt.timestamp.strftime("%d-%m-%y %H:%M:%S") if getattr(pmt, 'timestamp', None) else None,
|
||||||
height=pmt.transaction.height or 0,
|
height=pmt.transaction.height or 0,
|
||||||
hash=pmt.transaction.hash,
|
hash=pmt.transaction.hash,
|
||||||
amount=pmt.amount,
|
amount=pmt.amount,
|
||||||
fee=pmt.transaction.fee or 0,
|
fee=pmt.transaction.fee or 0,
|
||||||
payment_id=pmt.payment_id,
|
payment_id=pmt.payment_id,
|
||||||
addr=getattr(pmt, 'local_address', None) or '')
|
addr=getattr(pmt, 'local_address', None) or '')]
|
||||||
|
try:
|
||||||
|
for dest in pmt.destinations:
|
||||||
|
res.append(" {amount:17.12f} to {address}".format(address=dest[0], amount=dest[1]))
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
return "\n".join(res)
|
||||||
|
|
||||||
def a2str(a):
|
def a2str(a):
|
||||||
return "{addr} {label}".format(
|
return "{addr} {label}".format(
|
||||||
|
|
Loading…
Reference in New Issue