Add subfee option to wallets page.

2024-05-20_merge
tecnovert 6 years ago
parent 521e465c2a
commit c9954bef1a
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 6
      basicswap/basicswap.py
  2. 5
      basicswap/http_server.py

@ -802,9 +802,9 @@ class BasicSwap():
ticker = 'rt' + ticker
return ticker
def withdrawCoin(self, coin_type, value, addr_to):
self.log.info('withdrawCoin %s %s to %s', value, self.getTicker(coin_type), addr_to)
return self.callcoinrpc(coin_type, 'sendtoaddress', [addr_to, value])
def withdrawCoin(self, coin_type, value, addr_to, subfee):
self.log.info('withdrawCoin %s %s to %s %s', value, self.getTicker(coin_type), addr_to, ' subfee' if subfee else '')
return self.callcoinrpc(coin_type, 'sendtoaddress', [addr_to, value, '', '', subfee])
def cacheNewAddressForCoin(self, coin_type):
self.log.debug('cacheNewAddressForCoin %s', coin_type)

@ -119,7 +119,8 @@ class HttpHandler(BaseHTTPRequestHandler):
if bytes('withdraw_' + cid, 'utf-8') in form_data:
value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8')
address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8')
txid = swap_client.withdrawCoin(c, value, address)
subfee = True if bytes('subfee_' + cid, 'utf-8') in form_data else False
txid = swap_client.withdrawCoin(c, value, address, subfee)
ticker = swap_client.getTicker(c)
content += '<p>Withdrew {} {} to address {}<br/>In txid: {}</p>'.format(value, ticker, address, txid)
@ -134,7 +135,7 @@ class HttpHandler(BaseHTTPRequestHandler):
+ '<tr><td>Blocks:</td><td>' + str(w['blocks']) + '</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="withdraw_' + cid + '" value="Withdraw"></td><td>Amount: <input type="text" name="amt_' + cid + '"></td><td>Address: <input type="text" name="to_' + 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>' \
+ '</table>'
content += '<input type="hidden" name="formid" value="' + os.urandom(8).hex() + '"></form>'

Loading…
Cancel
Save