From ea52ff67c2563748f739a5bb53af3f858bc3d335 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 12 Oct 2022 00:59:30 +0200 Subject: [PATCH] Fix pivx withdrawals and install typo. --- basicswap/interface/pivx.py | 4 ++++ basicswap/ui/page_offers.py | 3 --- basicswap/ui/page_wallet.py | 34 +++++++++++++++++++--------------- doc/install.md | 2 +- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/basicswap/interface/pivx.py b/basicswap/interface/pivx.py index 870eebe..8cc4c53 100644 --- a/basicswap/interface/pivx.py +++ b/basicswap/interface/pivx.py @@ -54,3 +54,7 @@ class PIVXInterface(BTCInterface): } return block_rv + + def withdrawCoin(self, value, addr_to, subfee): + params = [addr_to, value, '', '', subfee] + return self.rpc_callback('sendtoaddress', params) diff --git a/basicswap/ui/page_offers.py b/basicswap/ui/page_offers.py index 5163289..781e901 100644 --- a/basicswap/ui/page_offers.py +++ b/basicswap/ui/page_offers.py @@ -297,8 +297,6 @@ def offer_to_post_string(self, swap_client, offer_id): 'validhrs': offer.time_valid // (60 * 60), } - swap_client.log.error('[rm] offer.amount_negotiable {}'.format(offer.amount_negotiable)) - swap_client.log.error('[rm] offer.rate_negotiable {}'.format(offer.rate_negotiable)) if offer.amount_negotiable: offer_data['amt_var'] = True if offer.rate_negotiable: @@ -311,7 +309,6 @@ def offer_to_post_string(self, swap_client, offer_id): offer_data['lockhrs'] = offer.lock_value // 60 try: strategy = swap_client.getLinkedStrategy(Concepts.OFFER, offer.offer_id) - swap_client.log.error('[rm] strategy {}'.format(strategy)) offer_data['automation_strat_id'] = strategy[0] except Exception: pass # None found diff --git a/basicswap/ui/page_wallet.py b/basicswap/ui/page_wallet.py index c2ea53e..447cbf7 100644 --- a/basicswap/ui/page_wallet.py +++ b/basicswap/ui/page_wallet.py @@ -65,7 +65,8 @@ def page_wallets(self, url_split, post_string): page_data = {} messages = [] - form_data = self.checkForm(post_string, 'wallets', messages) + err_messages = [] + form_data = self.checkForm(post_string, 'wallets', err_messages) if form_data: for c in Coins: if c not in chainparams: @@ -79,19 +80,19 @@ def page_wallets(self, url_split, post_string): swap_client.reseedWallet(c) messages.append('Reseed complete ' + str(c)) except Exception as ex: - messages.append('Reseed failed ' + str(ex)) + err_messages.append('Reseed failed ' + str(ex)) swap_client.updateWalletsInfo(True, c) elif bytes('withdraw_' + cid, 'utf-8') in form_data: try: value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8') page_data['wd_value_' + cid] = value except Exception as e: - messages.append('Error: Missing value') + err_messages.append('Missing value') try: address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8') page_data['wd_address_' + cid] = address except Exception as e: - messages.append('Error: Missing address') + err_messages.append('Missing address') subfee = True if bytes('subfee_' + cid, 'utf-8') in form_data else False page_data['wd_subfee_' + cid] = subfee @@ -103,7 +104,7 @@ def page_wallets(self, url_split, post_string): page_data['wd_type_from_' + cid] = type_from page_data['wd_type_to_' + cid] = type_to except Exception as e: - messages.append('Error: Missing type') + err_messages.append('Missing type') if len(messages) == 0: ci = swap_client.ci(c) @@ -113,13 +114,13 @@ def page_wallets(self, url_split, post_string): txid = swap_client.withdrawParticl(type_from, type_to, value, address, subfee) messages.append('Withdrew {} {} ({} to {}) to address {}
In txid: {}'.format(value, ticker, type_from, type_to, address, txid)) except Exception as e: - messages.append('Error: {}'.format(str(e))) + err_messages.append(str(e)) else: try: txid = swap_client.withdrawCoin(c, value, address, subfee) messages.append('Withdrew {} {} to address {}
In txid: {}'.format(value, ticker, address, txid)) except Exception as e: - messages.append('Error: {}'.format(str(e))) + err_messages.append(str(e)) swap_client.updateWalletsInfo(True, c) swap_client.updateWalletsInfo() @@ -153,6 +154,7 @@ def page_wallets(self, url_split, post_string): template = server.env.get_template('wallets.html') return self.render_template(template, { 'messages': messages, + 'err_messages': err_messages, 'wallets': wallets_formatted, 'summary': summary, }) @@ -169,7 +171,8 @@ def page_wallet(self, url_split, post_string): page_data = {} messages = [] - form_data = self.checkForm(post_string, 'settings', messages) + err_messages = [] + form_data = self.checkForm(post_string, 'wallet', err_messages) show_utxo_groups = False if form_data: cid = str(int(coin_id)) @@ -181,19 +184,19 @@ def page_wallet(self, url_split, post_string): swap_client.reseedWallet(coin_id) messages.append('Reseed complete ' + str(coin_id)) except Exception as ex: - messages.append('Reseed failed ' + str(ex)) + err_messages.append('Reseed failed ' + str(ex)) swap_client.updateWalletsInfo(True, coin_id) elif bytes('withdraw_' + cid, 'utf-8') in form_data: try: value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8') page_data['wd_value_' + cid] = value except Exception as e: - messages.append('Error: Missing value') + err_messages.append('Missing value') try: address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8') page_data['wd_address_' + cid] = address except Exception as e: - messages.append('Error: Missing address') + err_messages.append('Missing address') subfee = True if bytes('subfee_' + cid, 'utf-8') in form_data else False page_data['wd_subfee_' + cid] = subfee @@ -205,7 +208,7 @@ def page_wallet(self, url_split, post_string): page_data['wd_type_from_' + cid] = type_from page_data['wd_type_to_' + cid] = type_to except Exception as e: - messages.append('Error: Missing type') + err_messages.append('Missing type') if len(messages) == 0: ci = swap_client.ci(coin_id) @@ -215,13 +218,13 @@ def page_wallet(self, url_split, post_string): txid = swap_client.withdrawParticl(type_from, type_to, value, address, subfee) messages.append('Withdrew {} {} ({} to {}) to address {}
In txid: {}'.format(value, ticker, type_from, type_to, address, txid)) except Exception as e: - messages.append('Error: {}'.format(str(e))) + err_messages.append(str(e)) else: try: txid = swap_client.withdrawCoin(coin_id, value, address, subfee) messages.append('Withdrew {} {} to address {}
In txid: {}'.format(value, ticker, address, txid)) except Exception as e: - messages.append('Error: {}'.format(str(e))) + err_messages.append(str(e)) swap_client.updateWalletsInfo(True, coin_id) elif have_data_entry(form_data, 'showutxogroups'): show_utxo_groups = True @@ -238,7 +241,7 @@ def page_wallet(self, url_split, post_string): txid, address = ci.createUTXO(value_sats) messages.append('Created new utxo of value {} and address {}
In txid: {}'.format(value, address, txid)) except Exception as e: - messages.append('Error: {}'.format(str(e))) + err_messages.append(str(e)) if swap_client.debug is True: swap_client.log.error(traceback.format_exc()) @@ -305,6 +308,7 @@ def page_wallet(self, url_split, post_string): template = server.env.get_template('wallet.html') return self.render_template(template, { 'messages': messages, + 'err_messages': err_messages, 'w': wallet_data, 'summary': summary, }) diff --git a/doc/install.md b/doc/install.md index 0083e96..b79c4b3 100644 --- a/doc/install.md +++ b/doc/install.md @@ -9,7 +9,7 @@ Install dependencies: - apt-get curl jq + apt-get install curl jq Docker must be installed and started: