new proto.vm.tx.info module
This commit is contained in:
parent
5c83192bfd
commit
cd0538246a
4 changed files with 39 additions and 18 deletions
|
|
@ -12,11 +12,13 @@
|
|||
proto.eth.tx.info: Ethereum transaction info class
|
||||
"""
|
||||
|
||||
from ....tx.info import TxInfo, mmid_disp
|
||||
from ....tx.info import TxInfo
|
||||
from ....color import red, yellow, blue, cyan, pink
|
||||
from ....obj import NonNegativeInt
|
||||
|
||||
class TxInfo(TxInfo):
|
||||
from ...vm.tx.info import VmTxInfo, mmid_disp
|
||||
|
||||
class TxInfo(VmTxInfo, TxInfo):
|
||||
|
||||
to_addr_key = 'to'
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@
|
|||
proto.rune.tx.info: THORChain transaction info class
|
||||
"""
|
||||
|
||||
from ....tx.info import TxInfo, mmid_disp
|
||||
from ....tx.info import TxInfo
|
||||
from ....color import blue, pink
|
||||
from ....obj import NonNegativeInt
|
||||
|
||||
class TxInfo(TxInfo):
|
||||
from ...vm.tx.info import VmTxInfo, mmid_disp
|
||||
|
||||
class TxInfo(VmTxInfo, TxInfo):
|
||||
|
||||
def format_body(self, blockcount, nonmm_str, max_mmwid, enl, *, terse, sort):
|
||||
tx = self.tx
|
||||
|
|
|
|||
30
mmgen/proto/vm/tx/info.py
Executable file
30
mmgen/proto/vm/tx/info.py
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# MMGen Wallet, a terminal-based cryptocurrency wallet
|
||||
# Copyright (C)2013-2025 The MMGen Project <mmgen@tuta.io>
|
||||
# Licensed under the GNU General Public License, Version 3:
|
||||
# https://www.gnu.org/licenses
|
||||
# Public project repositories:
|
||||
# https://github.com/mmgen/mmgen-wallet
|
||||
# https://gitlab.com/mmgen/mmgen-wallet
|
||||
|
||||
"""
|
||||
proto.vm.tx.info: transaction info methods for VM chains
|
||||
"""
|
||||
|
||||
from ....util import fmt
|
||||
from ....addr import MMGenID
|
||||
|
||||
def mmid_disp(io, nonmm_str):
|
||||
return ' ' + (io.mmid.hl() if io.mmid else MMGenID.hlc(nonmm_str))
|
||||
|
||||
class VmTxInfo:
|
||||
|
||||
txinfo_hdr_fs = '{hdr}\n ID={i} ({a} {c}) Sig={s}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) Sig={s}\n'
|
||||
txinfo_ftr_fs = fmt("""
|
||||
Total in account: {i} {d}
|
||||
Total to spend: {o} {d}
|
||||
Remaining balance: {C} {d}
|
||||
TX fee: {a} {c}{r}
|
||||
""")
|
||||
|
|
@ -16,24 +16,11 @@ import importlib
|
|||
|
||||
from ..cfg import gc
|
||||
from ..color import red, green, cyan, orange, blue, yellow, magenta
|
||||
from ..util import msg, msg_r, fmt, decode_timestamp, make_timestr
|
||||
from ..util import msg, msg_r, decode_timestamp, make_timestr
|
||||
from ..util2 import format_elapsed_hr
|
||||
from ..addr import MMGenID
|
||||
|
||||
def mmid_disp(io, nonmm_str):
|
||||
return ' ' + (io.mmid.hl() if io.mmid else MMGenID.hlc(nonmm_str))
|
||||
|
||||
class TxInfo:
|
||||
|
||||
txinfo_hdr_fs = '{hdr}\n ID={i} ({a} {c}) Sig={s}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) Sig={s}\n'
|
||||
txinfo_ftr_fs = fmt("""
|
||||
Total in account: {i} {d}
|
||||
Total to spend: {o} {d}
|
||||
Remaining balance: {C} {d}
|
||||
TX fee: {a} {c}{r}
|
||||
""")
|
||||
|
||||
def __init__(self, cfg, tx):
|
||||
self.cfg = cfg
|
||||
self.tx = tx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue