From cfdd10dc60902a05ba88ac3109c4ac4dfbaad320 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 7 May 2025 18:24:07 +0000 Subject: [PATCH] proto.eth.tx.bump: fix file ext; tx.tx_proxy: error handling --- mmgen/proto/eth/tx/bump.py | 7 +++++-- mmgen/tx/tx_proxy.py | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mmgen/proto/eth/tx/bump.py b/mmgen/proto/eth/tx/bump.py index e99106c6..f72f7c27 100755 --- a/mmgen/proto/eth/tx/bump.py +++ b/mmgen/proto/eth/tx/bump.py @@ -18,6 +18,7 @@ from ....tx import bump as TxBase from .completed import Completed, TokenCompleted from .new import TokenNew from .new_swap import NewSwap +from .unsigned import AutomountUnsigned, TokenAutomountUnsigned class Bump(Completed, NewSwap, TxBase.Bump): desc = 'fee-bumped transaction' @@ -39,7 +40,9 @@ class TokenBump(TokenCompleted, TokenNew, Bump): desc = 'fee-bumped transaction' class AutomountBump(Bump): - pass + ext = AutomountUnsigned.ext + automount = AutomountUnsigned.automount class TokenAutomountBump(TokenBump): - pass + ext = TokenAutomountUnsigned.ext + automount = TokenAutomountUnsigned.automount diff --git a/mmgen/tx/tx_proxy.py b/mmgen/tx/tx_proxy.py index fe900d44..60a46d30 100755 --- a/mmgen/tx/tx_proxy.py +++ b/mmgen/tx/tx_proxy.py @@ -164,11 +164,14 @@ class EtherscanTxProxyClient(TxProxyClient): from ..obj import CoinTxID, is_coin_txid form = self.get_form_element(result_text) json_text = form.find('div/div/div')[1].tail - txid = json.loads(json_text)['result'].removeprefix('0x') - if is_coin_txid(txid): - return CoinTxID(txid) - else: - return False + txid = None + try: + txid = json.loads(json_text)['result'].removeprefix('0x') + except json.JSONDecodeError: + msg(json_text) + except Exception as e: + msg(f'{type(e).__name__}: {e}') + return CoinTxID(txid) if is_coin_txid(txid) else False def send_tx(cfg, txhex):