proto.rune.tx.online: support --receipt and --status
This commit is contained in:
parent
b361bab73a
commit
d24085f785
2 changed files with 37 additions and 1 deletions
|
|
@ -12,7 +12,7 @@
|
|||
proto.rune.tx.online: THORChain online signed transaction class
|
||||
"""
|
||||
|
||||
from ....util import pp_msg, die
|
||||
from ....util import msg, pp_msg, die
|
||||
from ....tx import online as TxBase
|
||||
|
||||
from .signed import Signed
|
||||
|
|
@ -41,6 +41,13 @@ class OnlineSigned(Signed, TxBase.OnlineSigned):
|
|||
async def post_network_send(self, coin_txid):
|
||||
return True
|
||||
|
||||
async def get_receipt(self, txid, *, receipt_only=False):
|
||||
try:
|
||||
return self.rpc.get_tx_info(txid)
|
||||
except Exception as e:
|
||||
msg(f'{type(e).__name__}: {e}')
|
||||
return False
|
||||
|
||||
class Sent(TxBase.Sent, OnlineSigned):
|
||||
pass
|
||||
|
||||
|
|
|
|||
29
mmgen/proto/rune/tx/status.py
Executable file
29
mmgen/proto/rune/tx/status.py
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/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.rune.tx.status: THORChain transaction status class
|
||||
"""
|
||||
|
||||
from ....util import msg, gmsg
|
||||
from ....tx import status as TxBase
|
||||
|
||||
class Status(TxBase.Status):
|
||||
|
||||
async def display(self, *, idx=''):
|
||||
|
||||
try:
|
||||
self.tx.rpc.get_tx_info(self.tx.coin_txid)
|
||||
except Exception as e:
|
||||
msg(f'{type(e).__name__}: {e}')
|
||||
return 2
|
||||
|
||||
gmsg('Transaction is in blockchain')
|
||||
return 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue