ui: Fix js value updates when sending bid.

This commit is contained in:
tecnovert 2022-07-29 00:47:32 +02:00
parent 871bdb918e
commit 7a3b41a11b
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 23 additions and 22 deletions

View file

@ -169,12 +169,12 @@ function updateBidParams(value_changed) {
let amt_from = ''; let amt_from = '';
let rate = ''; let rate = '';
if (amt_var) { if (amt_var == 'True') {
amt_from = document.getElementById('bid_amount').value; amt_from = document.getElementById('bid_amount').value;
} else { } else {
amt_from = document.getElementById('amount_from').value; amt_from = document.getElementById('amount_from').value;
} }
if (rate_var) { if (rate_var == 'True') {
rate = document.getElementById('bid_rate').value; rate = document.getElementById('bid_rate').value;
} else { } else {
rate = document.getElementById('offer_rate').value; rate = document.getElementById('offer_rate').value;

View file

@ -24,16 +24,21 @@ from basicswap.rpc_xmr import (
from tests.basicswap.mnemonics import mnemonics from tests.basicswap.mnemonics import mnemonics
from tests.basicswap.common import ( from tests.basicswap.common import (
waitForServer, waitForServer,
BASE_PORT, BASE_RPC_PORT,
BTC_BASE_PORT, BTC_BASE_RPC_PORT,
) )
from basicswap.contrib.rpcauth import generate_salt, password_to_hmac from basicswap.contrib.rpcauth import generate_salt, password_to_hmac
import basicswap.config as cfg import basicswap.config as cfg
import bin.basicswap_prepare as prepareSystem
import bin.basicswap_run as runSystem import bin.basicswap_run as runSystem
TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1')) TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1'))
PARTICL_PORT_BASE = int(os.getenv('PARTICL_PORT_BASE', '11938'))
BITCOIN_PORT_BASE = int(os.getenv('BITCOIN_PORT_BASE', '10938')) PARTICL_PORT_BASE = int(os.getenv('PARTICL_PORT_BASE', BASE_PORT))
PARTICL_RPC_PORT_BASE = int(os.getenv('PARTICL_RPC_PORT_BASE', BASE_RPC_PORT))
BITCOIN_PORT_BASE = int(os.getenv('BITCOIN_PORT_BASE', BTC_BASE_PORT))
BITCOIN_RPC_PORT_BASE = int(os.getenv('BITCOIN_RPC_PORT_BASE', BTC_BASE_RPC_PORT))
XMR_BASE_P2P_PORT = 17792 XMR_BASE_P2P_PORT = 17792
XMR_BASE_RPC_PORT = 29798 XMR_BASE_RPC_PORT = 29798
@ -43,7 +48,6 @@ LTC_BASE_PORT = 34792
LTC_BASE_RPC_PORT = 35792 LTC_BASE_RPC_PORT = 35792
LTC_BASE_ZMQ_PORT = 36792 LTC_BASE_ZMQ_PORT = 36792
EXTRA_CONFIG_JSON = json.loads(os.getenv('EXTRA_CONFIG_JSON', '{}')) EXTRA_CONFIG_JSON = json.loads(os.getenv('EXTRA_CONFIG_JSON', '{}'))
@ -78,8 +82,9 @@ def recursive_update_dict(base, new_vals):
def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None, num_nodes=3, use_rpcauth=False, extra_settings={}, port_ofs=0): def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None, num_nodes=3, use_rpcauth=False, extra_settings={}, port_ofs=0):
config_path = os.path.join(datadir_path, cfg.CONFIG_FILENAME) config_path = os.path.join(datadir_path, cfg.CONFIG_FILENAME)
os.environ['PART_RPC_PORT'] = str(PARTICL_PORT_BASE) os.environ['PART_RPC_PORT'] = str(PARTICL_RPC_PORT_BASE)
os.environ['BTC_RPC_PORT'] = str(BITCOIN_PORT_BASE) os.environ['BTC_RPC_PORT'] = str(BITCOIN_RPC_PORT_BASE)
import bin.basicswap_prepare as prepareSystem
testargs = [ testargs = [
'basicswap-prepare', 'basicswap-prepare',

View file

@ -13,7 +13,6 @@ cp -r ~/tmp/basicswap_bin/* ${TEST_PATH}/bin
export PYTHONPATH=$(pwd) export PYTHONPATH=$(pwd)
python tests/basicswap/extended/test_xmr_persistent.py python tests/basicswap/extended/test_xmr_persistent.py
""" """
import os import os
@ -37,9 +36,12 @@ from basicswap.rpc import (
from tests.basicswap.common import ( from tests.basicswap.common import (
read_json_api, read_json_api,
waitForServer, waitForServer,
BASE_RPC_PORT,
BTC_BASE_RPC_PORT,
) )
from tests.basicswap.common_xmr import ( from tests.basicswap.common_xmr import (
prepare_nodes, prepare_nodes,
XMR_BASE_RPC_PORT,
) )
import bin.basicswap_run as runSystem import bin.basicswap_run as runSystem
@ -51,15 +53,13 @@ def make_boolean(s):
test_path = os.path.expanduser(os.getenv('TEST_PATH', '/tmp/test_persistent')) test_path = os.path.expanduser(os.getenv('TEST_PATH', '/tmp/test_persistent'))
RESET_TEST = make_boolean(os.getenv('RESET_TEST', 'false')) RESET_TEST = make_boolean(os.getenv('RESET_TEST', 'false'))
XMR_BASE_P2P_PORT = 17792 PORT_OFS = int(os.getenv('PORT_OFS', 1))
XMR_BASE_RPC_PORT = 29798
XMR_BASE_WALLET_RPC_PORT = 29998
PORT_OFS = 1
UI_PORT = 12700 + PORT_OFS UI_PORT = 12700 + PORT_OFS
BASE_PART_RPC_PORT = 19792 PARTICL_RPC_PORT_BASE = int(os.getenv('PARTICL_RPC_PORT_BASE', BASE_RPC_PORT))
BASE_BTC_RPC_PORT = 19796 BITCOIN_RPC_PORT_BASE = int(os.getenv('BITCOIN_RPC_PORT_BASE', BTC_BASE_RPC_PORT))
XMR_BASE_RPC_PORT = int(os.getenv('XMR_BASE_RPC_PORT', XMR_BASE_RPC_PORT))
NUM_NODES = int(os.getenv('NUM_NODES', 3)) NUM_NODES = int(os.getenv('NUM_NODES', 3))
EXTRA_CONFIG_JSON = json.loads(os.getenv('EXTRA_CONFIG_JSON', '{}')) EXTRA_CONFIG_JSON = json.loads(os.getenv('EXTRA_CONFIG_JSON', '{}'))
@ -70,12 +70,12 @@ if not len(logger.handlers):
logger.addHandler(logging.StreamHandler(sys.stdout)) logger.addHandler(logging.StreamHandler(sys.stdout))
def callpartrpc(node_id, method, params=[], wallet=None, base_rpc_port=BASE_PART_RPC_PORT + PORT_OFS): def callpartrpc(node_id, method, params=[], wallet=None, base_rpc_port=PARTICL_RPC_PORT_BASE + PORT_OFS):
auth = 'test_part_{0}:test_part_pwd_{0}'.format(node_id) auth = 'test_part_{0}:test_part_pwd_{0}'.format(node_id)
return callrpc(base_rpc_port + node_id, auth, method, params, wallet) return callrpc(base_rpc_port + node_id, auth, method, params, wallet)
def callbtcrpc(node_id, method, params=[], wallet=None, base_rpc_port=BASE_BTC_RPC_PORT + PORT_OFS): def callbtcrpc(node_id, method, params=[], wallet=None, base_rpc_port=BITCOIN_RPC_PORT_BASE + PORT_OFS):
auth = 'test_btc_{0}:test_btc_pwd_{0}'.format(node_id) auth = 'test_btc_{0}:test_btc_pwd_{0}'.format(node_id)
return callrpc(base_rpc_port + node_id, auth, method, params, wallet) return callrpc(base_rpc_port + node_id, auth, method, params, wallet)
@ -120,8 +120,6 @@ class Test(unittest.TestCase):
random.seed(time.time()) random.seed(time.time())
os.environ['PARTICL_RPC_PORT_BASE'] = str(BASE_PART_RPC_PORT)
os.environ['BITCOIN_RPC_PORT_BASE'] = str(BASE_BTC_RPC_PORT)
logging.info('Preparing %d nodes.', NUM_NODES) logging.info('Preparing %d nodes.', NUM_NODES)
prepare_nodes(NUM_NODES, 'bitcoin,monero', True, {'min_sequence_lock_seconds': 60}, PORT_OFS) prepare_nodes(NUM_NODES, 'bitcoin,monero', True, {'min_sequence_lock_seconds': 60}, PORT_OFS)

View file

@ -40,8 +40,6 @@ from tests.basicswap.common_xmr import (
import bin.basicswap_run as runSystem import bin.basicswap_run as runSystem
TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1')) TEST_PATH = os.path.expanduser(os.getenv('TEST_PATH', '~/test_basicswap1'))
PARTICL_PORT_BASE = int(os.getenv('PARTICL_PORT_BASE', '11938'))
BITCOIN_PORT_BASE = int(os.getenv('BITCOIN_PORT_BASE', '10938'))
delay_event = threading.Event() delay_event = threading.Event()
logger = logging.getLogger() logger = logging.getLogger()