mirror of
https://github.com/basicswap/basicswap.git
synced 2024-11-16 15:58:17 +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
|
length += 1 # flags
|
||||||
return length
|
return length
|
||||||
|
|
||||||
|
def describeTx(self, tx_hex):
|
||||||
|
return self.rpc_callback('decoderawtransaction', [tx_hex])
|
||||||
|
|
||||||
|
|
||||||
def testBTCInterface():
|
def testBTCInterface():
|
||||||
print('testBTCInterface')
|
print('testBTCInterface')
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr><td>Swap</td><td>{{ data.amt_from }} {{ data.ticker_from }} for {{ data.amt_to }} {{ data.ticker_to }}</td></tr>
|
<tr><td>Swap</td><td>{{ data.amt_from }} {{ data.ticker_from }} for {{ data.amt_to }} {{ data.ticker_to }}</td></tr>
|
||||||
{% endif %}
|
{% 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>Bid State</td><td>{{ data.bid_state }}</td></tr>
|
||||||
<tr><td>State Description </td><td>{{ data.state_description }}</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>
|
<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 %}
|
{% if data.view_tx_hex %}
|
||||||
<p>{{ data.view_tx_hex }}</p>
|
<p>{{ data.view_tx_hex }}</p>
|
||||||
|
<textarea id="tx_view" rows="10" cols="150" readonly>
|
||||||
|
{{ data.view_tx_desc }}
|
||||||
|
</textarea>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if data.lock_transfers %}
|
{% 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'
|
state_description = f'Waiting for {ticker_to} lock tx spend tx to confirm in chain'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
'coin_from': ci_from.coin_name(),
|
||||||
|
'coin_to': ci_to.coin_name(),
|
||||||
'amt_from': ci_from.format_amount(bid.amount),
|
'amt_from': ci_from.format_amount(bid.amount),
|
||||||
'amt_to': ci_to.format_amount((bid.amount * offer.rate) // ci_from.COIN()),
|
'amt_to': ci_to.format_amount((bid.amount * offer.rate) // ci_from.COIN()),
|
||||||
'ticker_from': ticker_from,
|
'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()
|
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:
|
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()
|
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
|
return data
|
||||||
|
|
Loading…
Reference in a new issue