allow choosing Monero node type

This commit is contained in:
nahuhh 2024-01-26 05:31:51 -05:00
parent b77f11500c
commit 9d603800af
2 changed files with 25 additions and 12 deletions

View file

@ -19,13 +19,18 @@ pip3 install .
# Move scripts to /usr/local/bin
cd $SWAP_DATADIR
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx-*
sudo mkdir /usr/local/bin/bsx/
sudo mv -f -t /usr/local/bin/bsx/ dep/*
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx*
## Run basicswap-prepare with particl and monero
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT
$red; echo -e "\n\nMake note of your seed above\n"; $nocolor
if [[ "$monerod_addr" && "$monerod_port" ]]; then
# Use remote Monero node
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT
else # Use BasicSwapDEX's Monero node
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT
fi
$red; echo -e "\n\nMake note of your seed above\n"; $nocolor
echo 'Install complete.
Use `basicswap-bash` to run, `bsx-update` to update, and `bsx-addcoin` to add a coin'

View file

@ -7,8 +7,7 @@ green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m"
# Title Bar
$green
echo -e "\n"
$green "\n"
title="BasicSwapDEX installer"
COLUMNS=$(tput cols)
title_size=${#title}
@ -19,10 +18,19 @@ printf "%${COLUMNS}s" " " | tr " " "*"
$nocolor
## Configure Monero node
read -p $'\n\nEnter Address of Monero node [example: http://192.168.1.123] ' monerod_addr
read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port
$green; printf $monerod_addr:$monerod_port; $nocolor
echo -e "\nPress any key to continue, or CTRL-C to exit." && read
echo -e "\n\n[1]Connect to a Monero node\n[2]Allow BasicSwapDEX to run a Monero node (+70GB)\n"
until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option: ' l
case $l in
1) read -p 'Enter Address of Monero node [example: 192.168.1.123] ' monerod_addr
read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port
$green "Look good? $monerod_addr:$monerod_port"; $nocolor;;
2) $green "\nBasicSwapDEX will run the Monero node for you."; $nocolor;;
*) $red "\nYou must answer 1 or 2\n"; $nocolor;;
esac
done
echo -e "\nShall we begin?"
read -p 'Press any key to continue, or CTRL-C to exit.'
## Update & Install dependencies
sudo apt update