Fix pivx withdrawals and install typo.

2024-05-20_merge
tecnovert 2 years ago
parent bdcf6ce91b
commit ea52ff67c2
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 4
      basicswap/interface/pivx.py
  2. 3
      basicswap/ui/page_offers.py
  3. 34
      basicswap/ui/page_wallet.py
  4. 2
      doc/install.md

@ -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)

@ -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

@ -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 {}<br/>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 {}<br/>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 {}<br/>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 {}<br/>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 {}<br/>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,
})

@ -9,7 +9,7 @@
Install dependencies:
apt-get curl jq
apt-get install curl jq
Docker must be installed and started:

Loading…
Cancel
Save