Fix pivx withdrawals and install typo.

This commit is contained in:
tecnovert 2022-10-12 00:59:30 +02:00
parent bdcf6ce91b
commit ea52ff67c2
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 24 additions and 19 deletions

View file

@ -54,3 +54,7 @@ class PIVXInterface(BTCInterface):
} }
return block_rv return block_rv
def withdrawCoin(self, value, addr_to, subfee):
params = [addr_to, value, '', '', subfee]
return self.rpc_callback('sendtoaddress', params)

View file

@ -297,8 +297,6 @@ def offer_to_post_string(self, swap_client, offer_id):
'validhrs': offer.time_valid // (60 * 60), '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: if offer.amount_negotiable:
offer_data['amt_var'] = True offer_data['amt_var'] = True
if offer.rate_negotiable: 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 offer_data['lockhrs'] = offer.lock_value // 60
try: try:
strategy = swap_client.getLinkedStrategy(Concepts.OFFER, offer.offer_id) strategy = swap_client.getLinkedStrategy(Concepts.OFFER, offer.offer_id)
swap_client.log.error('[rm] strategy {}'.format(strategy))
offer_data['automation_strat_id'] = strategy[0] offer_data['automation_strat_id'] = strategy[0]
except Exception: except Exception:
pass # None found pass # None found

View file

@ -65,7 +65,8 @@ def page_wallets(self, url_split, post_string):
page_data = {} page_data = {}
messages = [] messages = []
form_data = self.checkForm(post_string, 'wallets', messages) err_messages = []
form_data = self.checkForm(post_string, 'wallets', err_messages)
if form_data: if form_data:
for c in Coins: for c in Coins:
if c not in chainparams: if c not in chainparams:
@ -79,19 +80,19 @@ def page_wallets(self, url_split, post_string):
swap_client.reseedWallet(c) swap_client.reseedWallet(c)
messages.append('Reseed complete ' + str(c)) messages.append('Reseed complete ' + str(c))
except Exception as ex: except Exception as ex:
messages.append('Reseed failed ' + str(ex)) err_messages.append('Reseed failed ' + str(ex))
swap_client.updateWalletsInfo(True, c) swap_client.updateWalletsInfo(True, c)
elif bytes('withdraw_' + cid, 'utf-8') in form_data: elif bytes('withdraw_' + cid, 'utf-8') in form_data:
try: try:
value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8') value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8')
page_data['wd_value_' + cid] = value page_data['wd_value_' + cid] = value
except Exception as e: except Exception as e:
messages.append('Error: Missing value') err_messages.append('Missing value')
try: try:
address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8') address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8')
page_data['wd_address_' + cid] = address page_data['wd_address_' + cid] = address
except Exception as e: 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 subfee = True if bytes('subfee_' + cid, 'utf-8') in form_data else False
page_data['wd_subfee_' + cid] = subfee 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_from_' + cid] = type_from
page_data['wd_type_to_' + cid] = type_to page_data['wd_type_to_' + cid] = type_to
except Exception as e: except Exception as e:
messages.append('Error: Missing type') err_messages.append('Missing type')
if len(messages) == 0: if len(messages) == 0:
ci = swap_client.ci(c) 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) 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)) messages.append('Withdrew {} {} ({} to {}) to address {}<br/>In txid: {}'.format(value, ticker, type_from, type_to, address, txid))
except Exception as e: except Exception as e:
messages.append('Error: {}'.format(str(e))) err_messages.append(str(e))
else: else:
try: try:
txid = swap_client.withdrawCoin(c, value, address, subfee) txid = swap_client.withdrawCoin(c, value, address, subfee)
messages.append('Withdrew {} {} to address {}<br/>In txid: {}'.format(value, ticker, address, txid)) messages.append('Withdrew {} {} to address {}<br/>In txid: {}'.format(value, ticker, address, txid))
except Exception as e: except Exception as e:
messages.append('Error: {}'.format(str(e))) err_messages.append(str(e))
swap_client.updateWalletsInfo(True, c) swap_client.updateWalletsInfo(True, c)
swap_client.updateWalletsInfo() swap_client.updateWalletsInfo()
@ -153,6 +154,7 @@ def page_wallets(self, url_split, post_string):
template = server.env.get_template('wallets.html') template = server.env.get_template('wallets.html')
return self.render_template(template, { return self.render_template(template, {
'messages': messages, 'messages': messages,
'err_messages': err_messages,
'wallets': wallets_formatted, 'wallets': wallets_formatted,
'summary': summary, 'summary': summary,
}) })
@ -169,7 +171,8 @@ def page_wallet(self, url_split, post_string):
page_data = {} page_data = {}
messages = [] messages = []
form_data = self.checkForm(post_string, 'settings', messages) err_messages = []
form_data = self.checkForm(post_string, 'wallet', err_messages)
show_utxo_groups = False show_utxo_groups = False
if form_data: if form_data:
cid = str(int(coin_id)) cid = str(int(coin_id))
@ -181,19 +184,19 @@ def page_wallet(self, url_split, post_string):
swap_client.reseedWallet(coin_id) swap_client.reseedWallet(coin_id)
messages.append('Reseed complete ' + str(coin_id)) messages.append('Reseed complete ' + str(coin_id))
except Exception as ex: except Exception as ex:
messages.append('Reseed failed ' + str(ex)) err_messages.append('Reseed failed ' + str(ex))
swap_client.updateWalletsInfo(True, coin_id) swap_client.updateWalletsInfo(True, coin_id)
elif bytes('withdraw_' + cid, 'utf-8') in form_data: elif bytes('withdraw_' + cid, 'utf-8') in form_data:
try: try:
value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8') value = form_data[bytes('amt_' + cid, 'utf-8')][0].decode('utf-8')
page_data['wd_value_' + cid] = value page_data['wd_value_' + cid] = value
except Exception as e: except Exception as e:
messages.append('Error: Missing value') err_messages.append('Missing value')
try: try:
address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8') address = form_data[bytes('to_' + cid, 'utf-8')][0].decode('utf-8')
page_data['wd_address_' + cid] = address page_data['wd_address_' + cid] = address
except Exception as e: 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 subfee = True if bytes('subfee_' + cid, 'utf-8') in form_data else False
page_data['wd_subfee_' + cid] = subfee 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_from_' + cid] = type_from
page_data['wd_type_to_' + cid] = type_to page_data['wd_type_to_' + cid] = type_to
except Exception as e: except Exception as e:
messages.append('Error: Missing type') err_messages.append('Missing type')
if len(messages) == 0: if len(messages) == 0:
ci = swap_client.ci(coin_id) 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) 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)) messages.append('Withdrew {} {} ({} to {}) to address {}<br/>In txid: {}'.format(value, ticker, type_from, type_to, address, txid))
except Exception as e: except Exception as e:
messages.append('Error: {}'.format(str(e))) err_messages.append(str(e))
else: else:
try: try:
txid = swap_client.withdrawCoin(coin_id, value, address, subfee) txid = swap_client.withdrawCoin(coin_id, value, address, subfee)
messages.append('Withdrew {} {} to address {}<br/>In txid: {}'.format(value, ticker, address, txid)) messages.append('Withdrew {} {} to address {}<br/>In txid: {}'.format(value, ticker, address, txid))
except Exception as e: except Exception as e:
messages.append('Error: {}'.format(str(e))) err_messages.append(str(e))
swap_client.updateWalletsInfo(True, coin_id) swap_client.updateWalletsInfo(True, coin_id)
elif have_data_entry(form_data, 'showutxogroups'): elif have_data_entry(form_data, 'showutxogroups'):
show_utxo_groups = True show_utxo_groups = True
@ -238,7 +241,7 @@ def page_wallet(self, url_split, post_string):
txid, address = ci.createUTXO(value_sats) txid, address = ci.createUTXO(value_sats)
messages.append('Created new utxo of value {} and address {}<br/>In txid: {}'.format(value, address, txid)) messages.append('Created new utxo of value {} and address {}<br/>In txid: {}'.format(value, address, txid))
except Exception as e: except Exception as e:
messages.append('Error: {}'.format(str(e))) err_messages.append(str(e))
if swap_client.debug is True: if swap_client.debug is True:
swap_client.log.error(traceback.format_exc()) 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') template = server.env.get_template('wallet.html')
return self.render_template(template, { return self.render_template(template, {
'messages': messages, 'messages': messages,
'err_messages': err_messages,
'w': wallet_data, 'w': wallet_data,
'summary': summary, 'summary': summary,
}) })

View file

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