EthereumMMGenTX: add change display to TX view summary
This commit is contained in:
parent
c5bf50ecbd
commit
dff3d48537
2 changed files with 14 additions and 1 deletions
|
|
@ -221,6 +221,7 @@ class EthereumMMGenTX:
|
|||
txview_ftr_fs = fmt("""
|
||||
Total in account: {i} {d}
|
||||
Total to spend: {o} {d}
|
||||
Remaining balance: {C} {d}
|
||||
TX fee: {a} {c}{r}
|
||||
""")
|
||||
fmt_keys = ('from','to','amt','nonce')
|
||||
|
|
@ -233,6 +234,10 @@ class EthereumMMGenTX:
|
|||
def fee(self):
|
||||
return self.fee_gasPrice2abs(self.txobj['gasPrice'].toWei())
|
||||
|
||||
@property
|
||||
def change(self):
|
||||
return self.sum_inputs() - self.send_amt - self.fee
|
||||
|
||||
def check_txfile_hex_data(self):
|
||||
pass
|
||||
|
||||
|
|
@ -525,6 +530,10 @@ class EthereumTokenMMGenTX:
|
|||
class Completed(Base,EthereumMMGenTX.Completed):
|
||||
fmt_keys = ('from','token_to','amt','nonce')
|
||||
|
||||
@property
|
||||
def change(self):
|
||||
return self.sum_inputs() - self.send_amt
|
||||
|
||||
def format_view_rel_fee(self,terse):
|
||||
return ''
|
||||
|
||||
|
|
|
|||
|
|
@ -1084,6 +1084,10 @@ class MMGenTX:
|
|||
def fee(self):
|
||||
return self.sum_inputs() - self.sum_outputs()
|
||||
|
||||
@property
|
||||
def change(self):
|
||||
return self.sum_outputs() - self.send_amt
|
||||
|
||||
def format_view_rel_fee(self,terse):
|
||||
return ' ({} {}, {} of spend amount)'.format(
|
||||
pink(str(self.fee_abs2rel(self.fee))),
|
||||
|
|
@ -1147,7 +1151,7 @@ class MMGenTX:
|
|||
yield self.txview_ftr_fs.format(
|
||||
i = self.sum_inputs().hl(),
|
||||
o = self.sum_outputs().hl(),
|
||||
C = (self.sum_outputs() - self.send_amt).hl(),
|
||||
C = self.change.hl(),
|
||||
s = self.send_amt.hl(),
|
||||
a = self.format_view_abs_fee(),
|
||||
r = self.format_view_rel_fee(terse),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue