INFO: menu options for m0, m4 and to show the DOCS

related: https://github.com/openoms/joininbox/issues/33
This commit is contained in:
openoms 2021-03-06 11:11:45 +00:00
parent 04f056cd74
commit c6be35e427
No known key found for this signature in database
GPG key ID: 5BFB77609B081B65
5 changed files with 98 additions and 52 deletions

0
scripts/_functions.bitcoincore.sh Normal file → Executable file
View file

View file

@ -107,8 +107,6 @@ function chooseWallet() {
echo "# Make sure to type the full filename of the wallet."
echo "# eg.: wallet.jmdat"
echo
echo "# Type 'menu' to return"
echo
exit 1
else
echo "# OK - the wallet file is present."

95
scripts/menu.info.sh Executable file
View file

@ -0,0 +1,95 @@
#!/bin/bash
# INFO menu options
source /home/joinmarket/joinin.conf
source /home/joinmarket/_functions.sh
function cacheAndShowQR() {
# cache wallet data
walletData=$(mktemp -p /dev/shm/)
clear
/home/joinmarket/start.script.sh wallet-tool "$(cat $wallet)" nomethod 0 2>&1 | tee $walletData
firstNewAddress=$(cat "$walletData" | grep "0.00000000 new" | sed -n 1p | awk '{print $2}')
echo
if [ ${#firstNewAddress} -eq 0 ]; then
echo "# Error: missing address data"
echo
echo "# Type 'menu' to return"
echo
exit 1
fi
# display data
cat "$walletData"
echo
echo "Fund the wallet on the first 'new' address to get started (displayed as a QR code also):"
echo "$firstNewAddress"
echo
qrencode -t ANSIUTF8 "${firstNewAddress}"
echo
shred $wallet $mixdepth $walletData
sudo rm -f /dev/shm/*
}
# BASIC MENU INFO
HEIGHT=9
WIDTH=52
CHOICE_HEIGHT=21
TITLE="Wallet management options"
BACKTITLE="Wallet management options"
MENU=""
OPTIONS=()
# Basic Options
OPTIONS+=(
m0 "Show the first mixdepth to deposit to"
m4 "Show the content of all mixdepths"
DOCS "Link to the documentation"
)
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
case $CHOICE in
m0)
checkRPCwallet
# wallet
chooseWallet
cacheAndShowQR
echo
echo "Press ENTER to return to the menu"
read key
;;
m4)
checkRPCwallet
# wallet
chooseWallet
/home/joinmarket/start.script.sh wallet-tool "$(cat $wallet)"
echo ""
echo "Fund the wallet on addresses labeled 'new' to avoid address reuse."
echo ""
echo "Press ENTER to return to the menu..."
read key
/home/joinmarket/menu.sh
;;
DOCS)
datastring="https://github.com/openoms/joininbox#more-info"
clear
echo
echo "Find a collection of written documentation and links to videos at:"
echo "$datastring"
echo
qrencode -t ANSIUTF8 "${datastring}"
echo
echo "Press ENTER to return to the menu..."
read key
;;
esac

View file

@ -45,42 +45,8 @@ CHOICE=$(dialog --clear \
case $CHOICE in
INFO)
checkRPCwallet
# wallet
chooseWallet
# mixdepth
mixdepth=$(mktemp -p /dev/shm/)
dialog --backtitle "Choose a mixdepth" \
--title "Choose a mixdepth" \
--inputbox "
Enter a number between 0 to 4 to limit the visible mixdepths
Leave the box empty to show the addresses in all five" 10 64 2> $mixdepth
openMenuIfCancelled $?
# cache wallet data
walletData=$(mktemp -p /dev/shm/)
clear
/home/joinmarket/start.script.sh wallet-tool "$(cat $wallet)" nomethod "$(cat $mixdepth)" 2>&1 | tee $walletData
firstNewAddress=$(cat "$walletData" | grep "0.00000000 new" | sed -n 1p | awk '{print $2}')
echo
if [ ${#firstNewAddress} -eq 0 ]; then
echo "# Error: missing address data"
echo
echo "# Type 'menu' to return"
echo
exit 1
fi
# display data
cat "$walletData"
echo
echo "Fund the wallet on the first 'new' address to get started (displayed as a QR code also):"
echo "$firstNewAddress"
echo
qrencode -t ANSIUTF8 "${firstNewAddress}"
echo
shred $wallet $mixdepth $walletData
sudo rm -f /dev/shm/*
echo "Press ENTER to return to the menu..."
read key
/home/joinmarket/menu.info.sh
waitKeyOnExit1 $?
/home/joinmarket/menu.sh
;;
WALLET)

View file

@ -33,7 +33,7 @@ function getQRstring {
}
# BASIC MENU INFO
HEIGHT=13
HEIGHT=12
WIDTH=55
CHOICE_HEIGHT=20
TITLE="Tools"
@ -48,7 +48,6 @@ if [ "${runningEnv}" = standalone ]; then
fi
OPTIONS+=(
QR "Display a QR code from any text"
DOCS "Show a link to the documentation"
CUSTOMRPC "Run a custom bitcoin RPC with curl"
BOLTZMANN "Analyze the entropy of a transaction"
PASSWORD "Change the ssh password"
@ -82,18 +81,6 @@ case $CHOICE in
echo "Press ENTER to return to the menu..."
read key
;;
DOCS)
datastring="https://github.com/openoms/joininbox#more-info"
clear
echo
echo "Find a collection of written documentation and links to videos at:"
echo "$datastring"
echo
qrencode -t ANSIUTF8 "${datastring}"
echo
echo "Press ENTER to return to the menu..."
read key
;;
BOLTZMANN)
installBoltzmann
getTXID