2021-05-22 16:51:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get raspiblitz config
|
|
|
|
echo "# get raspiblitz config"
|
|
|
|
source /home/admin/raspiblitz.info
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
|
2021-06-11 10:44:53 +02:00
|
|
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cln $1)
|
|
|
|
|
2021-05-22 16:51:22 +02:00
|
|
|
# get the local network IP to be displayed on the LCD
|
|
|
|
source <(/home/admin/config.scripts/internet.sh status local)
|
|
|
|
|
|
|
|
# BASIC MENU INFO
|
2021-07-18 16:19:52 +02:00
|
|
|
HEIGHT=14
|
2021-05-22 16:51:22 +02:00
|
|
|
WIDTH=64
|
2021-07-18 16:19:52 +02:00
|
|
|
CHOICE_HEIGHT=8
|
2021-05-22 16:51:22 +02:00
|
|
|
BACKTITLE="RaspiBlitz"
|
|
|
|
TITLE="C-Lightning Options"
|
|
|
|
MENU=""
|
|
|
|
OPTIONS=()
|
|
|
|
|
|
|
|
OPTIONS+=(FUNDING "Fund your C-Lightning Wallet")
|
2021-05-22 19:35:14 +02:00
|
|
|
OPTIONS+=(PEERING "Connect to a Peer")
|
2021-05-22 21:33:37 +02:00
|
|
|
OPTIONS+=(CHANNEL "Open a Channel with Peer")
|
2021-05-23 12:01:01 +02:00
|
|
|
OPTIONS+=(SEND "Pay an Invoice/PaymentRequest")
|
|
|
|
OPTIONS+=(RECEIVE "Create Invoice/PaymentRequest")
|
2021-06-11 11:33:12 +02:00
|
|
|
OPTIONS+=(SUMMARY "Information about this node")
|
2021-07-18 16:19:52 +02:00
|
|
|
OPTIONS+=(NAME "Change Name/Alias of the Node")
|
2021-05-22 16:51:22 +02:00
|
|
|
|
2021-06-11 10:44:53 +02:00
|
|
|
ln_getInfo=$($lightningcli_alias getinfo 2>/dev/null)
|
|
|
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
|
|
|
cln_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
|
|
|
|
openChannels=$((ln_channels_online+cln_num_inactive_channels))
|
2021-05-22 16:51:22 +02:00
|
|
|
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
2021-07-17 21:31:27 +02:00
|
|
|
OPTIONS+=(SUEZ "Visualize channels")
|
2021-07-06 09:05:28 +02:00
|
|
|
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
|
2021-07-17 21:31:27 +02:00
|
|
|
HEIGHT=$((HEIGHT+2))
|
|
|
|
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
|
2021-05-22 16:51:22 +02:00
|
|
|
fi
|
2021-06-11 11:33:12 +02:00
|
|
|
|
2021-05-28 21:28:56 +02:00
|
|
|
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = lnd ];then
|
|
|
|
OPTIONS+=(SWITCHLN "Use C-lightning as default")
|
|
|
|
HEIGHT=$((HEIGHT+1))
|
|
|
|
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
|
|
fi
|
2021-05-22 16:51:22 +02:00
|
|
|
|
2021-07-06 09:05:28 +02:00
|
|
|
OPTIONS+=(CASHOUT "Withdraw all funds from C-lightning on $CHAIN")
|
2021-05-22 16:51:22 +02:00
|
|
|
|
|
|
|
CHOICE=$(dialog --clear \
|
|
|
|
--backtitle "$BACKTITLE" \
|
|
|
|
--title "$TITLE" \
|
|
|
|
--ok-label "Select" \
|
|
|
|
--cancel-label "Main menu" \
|
|
|
|
--menu "$MENU" \
|
|
|
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
|
|
"${OPTIONS[@]}" \
|
|
|
|
2>&1 >/dev/tty)
|
|
|
|
|
|
|
|
case $CHOICE in
|
2021-06-11 11:33:12 +02:00
|
|
|
SUMMARY)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/config.scripts/cln-plugin.summary.sh $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
PEERING)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBconnectPeer.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
FUNDING)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBfundWallet.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
CASHOUT)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBcashoutWallet.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
CHANNEL)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBopenChannel.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
SEND)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBpayInvoice.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
RECEIVE)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBcreateInvoice.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
|
|
|
NAME)
|
2021-07-18 16:19:52 +02:00
|
|
|
sudo /home/admin/config.scripts/cln.setname.sh $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
;;
|
2021-07-17 21:31:27 +02:00
|
|
|
SUEZ)
|
|
|
|
clear
|
|
|
|
if [ ! -f /home/bitcoin/suez/suez ];then
|
|
|
|
/home/admin/config.scripts/bonus.suez.sh on
|
|
|
|
fi
|
|
|
|
cd /home/bitcoin/suez || exit 1
|
|
|
|
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \
|
|
|
|
--client=c-lightning \
|
|
|
|
--client-args=--conf=/home/bitcoin/.lightning/${netprefix}config
|
|
|
|
echo
|
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2021-05-28 21:28:56 +02:00
|
|
|
CLOSEALL)
|
2021-07-06 01:48:01 +02:00
|
|
|
/home/admin/BBcloseAllChannels.sh cln $CHAIN
|
2021-05-28 21:28:56 +02:00
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
|
|
|
SWITCHLN)
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
# setting value in raspi blitz config
|
|
|
|
sudo sed -i "s/^LNdefault=.*/LNdefault=cln/g" /mnt/hdd/raspiblitz.conf
|
|
|
|
echo "# OK - LNdefault=cln is set in /mnt/hdd/raspiblitz.conf"
|
|
|
|
echo
|
|
|
|
echo "Press ENTER to return to main menu."
|
|
|
|
read key
|
|
|
|
;;
|
2021-05-22 16:51:22 +02:00
|
|
|
esac
|