html: display estimated contract fee on the wallets page..

This commit is contained in:
tecnovert 2019-07-25 20:09:46 +02:00
parent a1b3aa74a1
commit 95729275b6
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 7 additions and 2 deletions

View file

@ -77,7 +77,7 @@ chainparams = {
'bip44': 1, 'bip44': 1,
'min_amount': 1000, 'min_amount': 1000,
'max_amount': 100000 * COIN, 'max_amount': 100000 * COIN,
'name': 'testnet4', 'name': 'testnet3',
}, },
'regtest': { 'regtest': {
'rpcport': 18443, 'rpcport': 18443,

View file

@ -139,12 +139,16 @@ class HttpHandler(BaseHTTPRequestHandler):
if 'error' in w: if 'error' in w:
content += '<p>Error: {}</p>'.format(w['error']) content += '<p>Error: {}</p>'.format(w['error'])
fee_rate = swap_client.getFeeRateForCoin(k)
tx_vsize = swap_client.getContractSpendTxVSize(k)
est_fee = (fee_rate * tx_vsize) / 1000
content += '<table>' \ content += '<table>' \
+ '<tr><td>Balance:</td><td>' + w['balance'] + '</td></tr>' \ + '<tr><td>Balance:</td><td>' + w['balance'] + '</td></tr>' \
+ '<tr><td>Blocks:</td><td>' + str(w['blocks']) + '</td></tr>' \ + '<tr><td>Blocks:</td><td>' + str(w['blocks']) + '</td></tr>' \
+ '<tr><td>Synced:</td><td>' + str(w['synced']) + '</td></tr>' \ + '<tr><td>Synced:</td><td>' + str(w['synced']) + '</td></tr>' \
+ '<tr><td><input type="submit" name="newaddr_' + cid + '" value="Deposit Address"></td><td>' + str(w['deposit_address']) + '</td></tr>' \ + '<tr><td><input type="submit" name="newaddr_' + cid + '" value="Deposit Address"></td><td>' + str(w['deposit_address']) + '</td></tr>' \
+ '<tr><td><input type="submit" name="withdraw_' + cid + '" value="Withdraw"></td><td>Amount: <input type="text" name="amt_' + cid + '"></td><td>Address: <input type="text" name="to_' + cid + '"></td><td>Subtract fee: <input type="checkbox" name="subfee_' + cid + '"></td></tr>' \ + '<tr><td><input type="submit" name="withdraw_' + cid + '" value="Withdraw"></td><td>Amount: <input type="text" name="amt_' + cid + '"></td><td>Address: <input type="text" name="to_' + cid + '"></td><td>Subtract fee: <input type="checkbox" name="subfee_' + cid + '"></td></tr>' \
+ '<tr><td>Fee Rate:</td><td>' + format8(fee_rate * COIN) + '</td><td>Est Fee:</td><td>' + format8(est_fee * COIN) + '</td></tr>' \
+ '</table>' + '</table>'
content += '<input type="hidden" name="formid" value="' + os.urandom(8).hex() + '"></form>' content += '<input type="hidden" name="formid" value="' + os.urandom(8).hex() + '"></form>'

View file

@ -373,7 +373,8 @@ def main():
'rpcport': 19796 + port_offset, 'rpcport': 19796 + port_offset,
'datadir': os.path.join(data_dir, 'bitcoin'), 'datadir': os.path.join(data_dir, 'bitcoin'),
'bindir': os.path.join(data_dir, 'bin', 'bitcoin'), 'bindir': os.path.join(data_dir, 'bin', 'bitcoin'),
'use_segwit': True 'use_segwit': True,
'blocks_confirmed': 1
}, },
'namecoin': { 'namecoin': {
'connection_type': 'rpc' if 'namecoin' in with_coins else 'none', 'connection_type': 'rpc' if 'namecoin' in with_coins else 'none',