minor cleanups
This commit is contained in:
parent
ef76cf6460
commit
5c83192bfd
9 changed files with 12 additions and 12 deletions
|
|
@ -169,5 +169,4 @@ def make_sig(*, sign_doc, sec_bytes):
|
|||
from py_ecc.secp256k1.secp256k1 import ecdsa_raw_sign
|
||||
msghash = sha256(bytes(sign_doc)).digest()
|
||||
_, r, s = ecdsa_raw_sign(msghash, sec_bytes)
|
||||
# pmsg('v:', _) # DEBUG
|
||||
return r.to_bytes(length=32) + s.to_bytes(length=32)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@ proto.eth.tx.info: Ethereum transaction info class
|
|||
"""
|
||||
|
||||
from ....tx.info import TxInfo, mmid_disp
|
||||
from ....util import pp_fmt
|
||||
from ....color import red, yellow, blue, cyan, pink
|
||||
from ....obj import Int
|
||||
from ....obj import NonNegativeInt
|
||||
|
||||
class TxInfo(TxInfo):
|
||||
|
||||
|
|
@ -47,7 +46,7 @@ class TxInfo(TxInfo):
|
|||
m = pink(tx.swap_memo) if tx.is_swap else None,
|
||||
c = tx.proto.dcoin if len(tx.outputs) else '',
|
||||
g = yellow(tx.pretty_fmt_fee(t['gasPrice'].to_unit('Gwei'))),
|
||||
G = Int(tx.total_gas).hl(),
|
||||
G = NonNegativeInt(tx.total_gas).hl(),
|
||||
G_dec = red(f" ({t['startGas']} + {t['router_gas']})") if tokenswap else '',
|
||||
f_mmid = mmid_disp(tx.inputs[0], nonmm_str),
|
||||
t_mmid = mmid_disp(tx.outputs[0], nonmm_str) if tx.outputs and not tx.is_swap else '') + '\n\n'
|
||||
|
|
@ -62,6 +61,7 @@ class TxInfo(TxInfo):
|
|||
|
||||
def format_verbose_footer(self):
|
||||
if self.tx.txobj['data'] and not self.tx.is_swap:
|
||||
from ....util import pp_fmt
|
||||
from ..contract import parse_abi
|
||||
return '\nParsed contract data: ' + pp_fmt(parse_abi(self.tx.txobj['data']))
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -77,11 +77,11 @@ class THORChainRemoteRPCClient(RemoteRPCClient):
|
|||
data = {'hash': '0x' + txhash}),
|
||||
errmsg = f'get info for transaction {txhash} failed')
|
||||
|
||||
def tx_op(self, txbytes, op=None):
|
||||
assert isinstance(txbytes, bytes)
|
||||
def tx_op(self, txhex, op=None):
|
||||
assert isinstance(txhex, str)
|
||||
assert op in ('check_tx', 'broadcast_tx_sync', 'broadcast_tx_async')
|
||||
return process_response(
|
||||
self.rpc_api.post(
|
||||
path = '/' + op,
|
||||
data = {'tx': '0x' + txbytes.hex()}),
|
||||
data = {'tx': '0x' + txhex}),
|
||||
errmsg = f'transaction operation ‘{op}’ failed')
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from .signed import Signed
|
|||
class OnlineSigned(Signed, TxBase.OnlineSigned):
|
||||
|
||||
async def test_sendable(self, txhex):
|
||||
res = self.rpc.tx_op(bytes.fromhex(txhex), op='check_tx')
|
||||
res = self.rpc.tx_op(txhex, op='check_tx')
|
||||
if res['code'] == 0:
|
||||
return True
|
||||
else:
|
||||
|
|
@ -31,7 +31,7 @@ class OnlineSigned(Signed, TxBase.OnlineSigned):
|
|||
pass
|
||||
|
||||
async def send_with_node(self, txhex):
|
||||
res = self.rpc.tx_op(bytes.fromhex(txhex), op='broadcast_tx_sync') # broadcast_tx_async
|
||||
res = self.rpc.tx_op(txhex, op='broadcast_tx_sync') # broadcast_tx_async
|
||||
if res['code'] == 0:
|
||||
return res['hash'].lower()
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# https://gitlab.com/mmgen/mmgen-wallet
|
||||
|
||||
"""
|
||||
proto.vm.tx.new: new transaction class methods for VM chains
|
||||
proto.vm.tx.new: new transaction methods for VM chains
|
||||
"""
|
||||
|
||||
from ....obj import MMGenTxID
|
||||
|
|
|
|||
|
|
@ -734,6 +734,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
if not parent.keypress_confirm(
|
||||
f'Refreshing tracking wallet {parent.item_desc} #{idx}. OK?'):
|
||||
return 'redo'
|
||||
msg_r('Refreshing balance...')
|
||||
res = await parent.twctl.get_balance(parent.disp_data[idx-1].addr, force_rpc=True)
|
||||
if res is None:
|
||||
parent.oneshot_msg = red(
|
||||
|
|
|
|||
|
|
@ -44,5 +44,6 @@ rec {
|
|||
# pysocks = pysocks; # XMR
|
||||
# monero = monero; # XMR (test suite)
|
||||
# eth-keys = eth-keys; # ETH, ETC (test suite)
|
||||
# pure-protobuf = pure-protobuf; # THORChain
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ dfl_dfl_path = "0'/0/0"
|
|||
|
||||
def get_bip_utils_data(bipnum, n):
|
||||
name, v = bip_utils_data[bipnum][n]
|
||||
#pexit(v.__dict__)
|
||||
vb_prv = v.m_key_net_ver.m_priv_net_ver.hex()
|
||||
vb_pub = v.m_key_net_ver.m_pub_net_ver.hex()
|
||||
ap = v.m_addr_params
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class unit_tests:
|
|||
res = rpc.get_tx_info(txhash)
|
||||
assert res['hash'] == txhash.upper()
|
||||
|
||||
res = rpc.tx_op(txbytes, op='check_tx')
|
||||
res = rpc.tx_op(txbytes.hex(), op='check_tx')
|
||||
assert res['code'] == 0
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue