Display xmr-swap script coin lock spend tx fees.
This commit is contained in:
parent
28b42c7432
commit
0c9429bfa5
@ -398,6 +398,11 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
page_data['from_fee_override'] = ci_from.format_amount(ci_from.make_int(from_fee_override, r=1))
|
||||
parsed_data['from_fee_override'] = page_data['from_fee_override']
|
||||
|
||||
lock_spend_tx_vsize = ci_from.xmr_swap_alock_spend_tx_vsize()
|
||||
lock_spend_tx_fee = ci_from.make_int(ci_from.make_int(from_fee_override, r=1) * lock_spend_tx_vsize / 1000, r=1)
|
||||
page_data['amt_from_lock_spend_tx_fee'] = ci_from.format_amount(lock_spend_tx_fee // ci_from.COIN())
|
||||
page_data['tla_from'] = ci_from.ticker()
|
||||
|
||||
if coin_to == Coins.XMR:
|
||||
if b'fee_rate_to' in form_data:
|
||||
page_data['to_fee_override'] = form_data[b'fee_rate_to'][0].decode('utf-8')
|
||||
@ -565,6 +570,10 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
data['a_fee_rate_verify_src'] = fee_source
|
||||
data['a_fee_warn'] = xmr_offer.a_fee_rate < int_fee_rate_now
|
||||
|
||||
lock_spend_tx_vsize = ci_from.xmr_swap_alock_spend_tx_vsize()
|
||||
lock_spend_tx_fee = ci_from.make_int(xmr_offer.a_fee_rate * lock_spend_tx_vsize / 1000, r=1)
|
||||
data['amt_from_lock_spend_tx_fee'] = ci_from.format_amount(lock_spend_tx_fee // ci_from.COIN())
|
||||
|
||||
if offer.was_sent:
|
||||
data['auto_accept'] = 'True' if offer.auto_accept_bids else 'False'
|
||||
|
||||
|
@ -111,6 +111,10 @@ class BTCInterface(CoinInterface):
|
||||
def compareFeeRates(a, b):
|
||||
return abs(a - b) < 20
|
||||
|
||||
@staticmethod
|
||||
def xmr_swap_alock_spend_tx_vsize():
|
||||
return 147
|
||||
|
||||
def __init__(self, coin_settings, network):
|
||||
super().__init__()
|
||||
self.rpc_callback = make_rpc_func(coin_settings['rpcport'], coin_settings['rpcauth'], host=coin_settings['rpchost'])
|
||||
@ -409,7 +413,7 @@ class BTCInterface(CoinInterface):
|
||||
|
||||
witness_bytes = len(script_lock)
|
||||
witness_bytes += 33 # sv, size
|
||||
witness_bytes += 73 * 2 # 2 signatures (72 + 1 byts size)
|
||||
witness_bytes += 73 * 2 # 2 signatures (72 + 1 byte size)
|
||||
witness_bytes += 4 # 1 empty, 1 true witness stack values
|
||||
witness_bytes += getCompactSizeLen(witness_bytes)
|
||||
vsize = self.getTxVSize(tx, add_witness_bytes=witness_bytes)
|
||||
|
@ -31,6 +31,10 @@ class PARTInterface(BTCInterface):
|
||||
def txVersion():
|
||||
return 0xa0
|
||||
|
||||
@staticmethod
|
||||
def xmr_swap_alock_spend_tx_vsize():
|
||||
return 213
|
||||
|
||||
def __init__(self, coin_settings, network):
|
||||
self.rpc_callback = make_rpc_func(coin_settings['rpcport'], coin_settings['rpcauth'], host=coin_settings['rpchost'])
|
||||
self.txoType = CTxOutPart
|
||||
|
@ -42,7 +42,7 @@
|
||||
<form method="post">
|
||||
{% if data.show_bid_form %}
|
||||
<br/><h4>New Bid</h4>
|
||||
<p>You will send {{ data.amt_to }} {{ data.tla_to }} and receive {{ data.amt_from }} {{ data.tla_from }}</p>
|
||||
<p>You will send {{ data.amt_to }} {{ data.tla_to }} and receive {{ data.amt_from }} {{ data.tla_from }} (excluding {{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }} in tx fees). </p>
|
||||
<table>
|
||||
<tr><td>Send From Address</td><td>
|
||||
<select name="addr_from">
|
||||
@ -64,7 +64,6 @@
|
||||
<input type="hidden" name="formid" value="{{ form_id }}">
|
||||
</form>
|
||||
|
||||
|
||||
<h4>Bids</h4>
|
||||
<table>
|
||||
<tr><th>Bid ID</th><th>Bid Amount</th><th>Bid Status</th><th>ITX Status</th><th>PTX Status</th></tr>
|
||||
|
@ -23,15 +23,16 @@
|
||||
</select>
|
||||
</td><td>Amount From</td><td><input type="text" name="amt_from" value="{{ data.amt_from }}" readonly></td><td>The amount you will send.</td></tr>
|
||||
{% if data.swap_style == 'xmr' %}
|
||||
</td><td>Fee Rate From</td><td><input name="fee_rate_from" value="{{ data.from_fee_override }}" readonly></td><td>Fee Rate Source</td><td>{{ data.from_fee_src }}</td></tr>
|
||||
</td><td>Fee From Confirm Target</td><td><input type="number" name="fee_from_conf" min="1" max="32" value="{{ data.fee_from_conf }}" readonly></td></tr>
|
||||
</td><td>Fee From Extra Fee</td><td>
|
||||
<tr><td>Fee Rate From</td><td><input name="fee_rate_from" value="{{ data.from_fee_override }}" readonly></td><td>Fee Rate Source</td><td>{{ data.from_fee_src }}</td></tr>
|
||||
<tr><td>Fee From Confirm Target</td><td><input type="number" name="fee_from_conf" min="1" max="32" value="{{ data.fee_from_conf }}" readonly></td></tr>
|
||||
<tr><td>Fee From Increase By</td><td>
|
||||
<select name="fee_from_extra_" disabled>
|
||||
<option value="0">None</option>
|
||||
<option value="10"{% if data.fee_from_extra==10 %} selected{% endif %}>10%</option>
|
||||
<option value="50"{% if data.fee_from_extra==50 %} selected{% endif %}>50%</option>
|
||||
<option value="100"{% if data.fee_from_extra==100 %} selected{% endif %}>100%</option>
|
||||
</select></td></tr>
|
||||
<tr><td>Lock Tx Spend Fee</td><td>{{ data.amt_from_lock_spend_tx_fee }} {{ data.tla_from }}</td></tr>
|
||||
{% endif %}
|
||||
|
||||
<tr><td>Coin To</td><td>
|
||||
@ -42,9 +43,9 @@
|
||||
</select>
|
||||
</td><td>Amount To</td><td><input type="text" name="amt_to" value="{{ data.amt_to }}" readonly></td><td>The amount you will receive.</td></tr>
|
||||
{% if data.swap_style == 'xmr' and coin_to != '6' %}
|
||||
</td><td>Fee Rate To</td><td><input name="fee_rate_to" value="{{ data.to_fee_override }}" readonly></td><td>Fee Rate Source</td><td>{{ data.to_fee_src }}</td></tr>
|
||||
</td><td>Fee To Confirm Target</td><td><input type="number" name="fee_to_conf" min="1" max="32" value="{{ data.fee_to_conf }}" readonly></td></tr>
|
||||
</td><td>Fee To Extra Fee</td><td>
|
||||
<tr><td>Fee Rate To</td><td><input name="fee_rate_to" value="{{ data.to_fee_override }}" readonly></td><td>Fee Rate Source</td><td>{{ data.to_fee_src }}</td></tr>
|
||||
<tr><td>Fee To Confirm Target</td><td><input type="number" name="fee_to_conf" min="1" max="32" value="{{ data.fee_to_conf }}" readonly></td></tr>
|
||||
<tr><td>Fee To Increase By</td><td>
|
||||
<select name="fee_to_extra_" disabled>
|
||||
<option value="0">None</option>
|
||||
<option value="10"{% if data.fee_to_extra==10 %} selected{% endif %}>10%</option>
|
||||
|
@ -23,8 +23,8 @@
|
||||
</select>
|
||||
</td><td>Amount From</td><td><input type="text" name="amt_from" value="{{ data.amt_from }}" readonly></td><td>The amount you will send.</td></tr>
|
||||
{% if data.swap_style == 'xmr' %}
|
||||
</td><td>Fee From Confirm Target</td><td><input type="number" name="fee_from_conf" min="1" max="32" value="{{ data.fee_from_conf }}"></td></tr>
|
||||
</td><td>Fee From Extra Fee</td><td>
|
||||
<tr><td>Fee From Confirm Target</td><td><input type="number" name="fee_from_conf" min="1" max="32" value="{{ data.fee_from_conf }}"></td></tr>
|
||||
<tr><td>Fee From Increase By</td><td>
|
||||
<select name="fee_from_extra">
|
||||
<option value="0">None</option>
|
||||
<option value="10"{% if data.fee_from_extra==10 %} selected{% endif %}>10%</option>
|
||||
@ -41,8 +41,8 @@
|
||||
</select>
|
||||
</td><td>Amount To</td><td><input type="text" name="amt_to" value="{{ data.amt_to }}" readonly></td><td>The amount you will receive.</td></tr>
|
||||
{% if data.swap_style == 'xmr' and coin_to != '6' %}
|
||||
</td><td>Fee To Confirm Target</td><td><input type="number" name="fee_to_conf" min="1" max="32" value="{{ data.fee_to_conf }}"></td></tr>
|
||||
</td><td>Fee To Extra Fee</td><td>
|
||||
<tr><td>Fee To Confirm Target</td><td><input type="number" name="fee_to_conf" min="1" max="32" value="{{ data.fee_to_conf }}"></td></tr>
|
||||
<tr><td>Fee To Increase By</td><td>
|
||||
<select name="fee_to_extra">
|
||||
<option value="0">None</option>
|
||||
<option value="10"{% if data.fee_to_extra==10 %} selected{% endif %}>10%</option>
|
||||
|
Loading…
Reference in New Issue
Block a user