mmgen-txsend: add --receipt option
This commit is contained in:
parent
3b3834f521
commit
ff9a1e08d8
2 changed files with 11 additions and 6 deletions
|
|
@ -53,6 +53,7 @@ opts_data = {
|
|||
{tx_proxies}). This is done via a publicly accessible web
|
||||
page, so no API key or registration is required
|
||||
-q, --quiet Suppress warnings; overwrite files without prompting
|
||||
-r, --receipt Print the receipt of the sent transaction (Ethereum only)
|
||||
-s, --status Get status of a sent transaction (or current transaction,
|
||||
whether sent or unsent, when used with --autosign)
|
||||
-t, --test Test whether the transaction can be sent without sending it
|
||||
|
|
@ -147,6 +148,9 @@ async def main():
|
|||
await post_send(tx)
|
||||
sys.exit(0)
|
||||
|
||||
if cfg.receipt:
|
||||
sys.exit(await tx.status.display(print_receipt=True))
|
||||
|
||||
if cfg.status:
|
||||
if tx.coin_txid:
|
||||
cfg._util.qmsg(f'{tx.proto.coin} txid: {tx.coin_txid.hl()}')
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ proto.eth.tx.status: Ethereum transaction status class
|
|||
"""
|
||||
|
||||
from ....tx import status as TxBase
|
||||
from ....util import msg, die, suf, capfirst, pp_fmt
|
||||
from ....util import msg, Msg, die, suf, capfirst, pp_fmt
|
||||
|
||||
class Status(TxBase.Status):
|
||||
|
||||
async def display(self, *, usr_req=False, return_exit_val=False):
|
||||
async def display(self, *, usr_req=False, return_exit_val=False, print_receipt=False):
|
||||
|
||||
def do_exit(retval, message):
|
||||
if return_exit_val:
|
||||
|
|
@ -54,11 +54,12 @@ class Status(TxBase.Status):
|
|||
'Warning: transaction is in mempool!')
|
||||
return
|
||||
|
||||
if usr_req:
|
||||
if usr_req or print_receipt:
|
||||
ret = await is_in_wallet()
|
||||
if tx.cfg.verbose:
|
||||
from ....color import cyan
|
||||
msg('{}\n{}'.format(cyan('TRANSACTION RECEIPT'), pp_fmt(ret.rx)))
|
||||
if print_receipt:
|
||||
import json
|
||||
Msg(json.dumps(ret.rx, indent=4))
|
||||
return not ret.exec_status
|
||||
if ret:
|
||||
if tx.txobj['data'] and not tx.is_swap:
|
||||
cd = capfirst(tx.contract_desc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue