mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-22 11:39:34 +00:00
ui: Display decoded tx in View Tx output.
This commit is contained in:
parent
b8fd4ad85b
commit
1d6f55b8b9
3 changed files with 15 additions and 0 deletions
|
@ -1044,6 +1044,9 @@ class BTCInterface(CoinInterface):
|
|||
length += 1 # flags
|
||||
return length
|
||||
|
||||
def describeTx(self, tx_hex):
|
||||
return self.rpc_callback('decoderawtransaction', [tx_hex])
|
||||
|
||||
|
||||
def testBTCInterface():
|
||||
print('testBTCInterface')
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
{% else %}
|
||||
<tr><td>Swap</td><td>{{ data.amt_from }} {{ data.ticker_from }} for {{ data.amt_to }} {{ data.ticker_to }}</td></tr>
|
||||
{% endif %}
|
||||
<tr><td>Coin From</td><td>{{ data.coin_from }}</td></tr>
|
||||
<tr><td>Coin To</td><td>{{ data.coin_to }}</td></tr>
|
||||
<tr><td>Bid State</td><td>{{ data.bid_state }}</td></tr>
|
||||
<tr><td>State Description </td><td>{{ data.state_description }}</td></tr>
|
||||
<tr><td>Offer</td><td><a href="/offer/{{ data.offer_id }}">{{ data.offer_id }}</a></td></tr>
|
||||
|
@ -83,6 +85,9 @@
|
|||
|
||||
{% if data.view_tx_hex %}
|
||||
<p>{{ data.view_tx_hex }}</p>
|
||||
<textarea id="tx_view" rows="10" cols="150" readonly>
|
||||
{{ data.view_tx_desc }}
|
||||
</textarea>
|
||||
{% endif %}
|
||||
|
||||
{% if data.lock_transfers %}
|
||||
|
|
|
@ -203,6 +203,8 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
|
|||
state_description = f'Waiting for {ticker_to} lock tx spend tx to confirm in chain'
|
||||
|
||||
data = {
|
||||
'coin_from': ci_from.coin_name(),
|
||||
'coin_to': ci_to.coin_name(),
|
||||
'amt_from': ci_from.format_amount(bid.amount),
|
||||
'amt_to': ci_to.format_amount((bid.amount * offer.rate) // ci_from.COIN()),
|
||||
'ticker_from': ticker_from,
|
||||
|
@ -291,5 +293,10 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
|
|||
data['view_tx_hex'] = xmr_swap.a_lock_refund_tx.hex()
|
||||
if view_tx_id == xmr_swap.a_lock_refund_spend_tx_id and xmr_swap.a_lock_refund_spend_tx:
|
||||
data['view_tx_hex'] = xmr_swap.a_lock_refund_spend_tx.hex()
|
||||
if view_tx_id == xmr_swap.a_lock_spend_tx_id and xmr_swap.a_lock_spend_tx:
|
||||
data['view_tx_hex'] = xmr_swap.a_lock_spend_tx.hex()
|
||||
|
||||
if 'view_tx_hex' in data:
|
||||
data['view_tx_desc'] = json.dumps(ci_from.describeTx(data['view_tx_hex']), indent=4)
|
||||
|
||||
return data
|
||||
|
|
Loading…
Reference in a new issue