joininbox/scripts/menu.wallet.sh

128 lines
3.5 KiB
Bash
Raw Normal View History

2020-06-15 15:35:18 +01:00
#!/bin/bash
# WALLET menu options
source /home/joinmarket/joinin.conf
source /home/joinmarket/_functions.sh
2020-06-15 15:35:18 +01:00
checkRPCwallet
2020-06-15 15:35:18 +01:00
# BASIC MENU INFO
2021-03-02 21:22:19 +00:00
HEIGHT=14
2020-06-15 15:35:18 +01:00
WIDTH=52
CHOICE_HEIGHT=21
2020-10-14 09:39:28 +01:00
TITLE="Wallet management options"
BACKTITLE="Wallet management options"
MENU=""
2020-06-15 15:35:18 +01:00
OPTIONS=()
# Basic Options
2021-03-02 21:22:19 +00:00
OPTIONS+=(
GEN "Generate a new wallet"
HISTORY "Show all past transactions"
IMPORT "Copy wallet(s) from a remote node"
RECOVER "Restore a wallet from the seed"
UNLOCK "Remove the lockfiles"
RESCAN "Rescan the Bitcoin Core wallet"
2021-03-02 15:45:00 +00:00
XPUBS "Show the master public keys"
2021-03-02 21:22:19 +00:00
PSBT "Sign an externally prepared PSBT"
2020-06-15 15:35:18 +01:00
)
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--ok-label "Select" \
--cancel-label "Back" \
2020-06-15 15:35:18 +01:00
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
case $CHOICE in
2020-06-21 01:03:29 +01:00
GEN)
clear
echo ""
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
if [ "${RPCoverTor}" = "on" ]; then
2020-06-21 01:03:29 +01:00
torify python /home/joinmarket/joinmarket-clientserver/scripts/wallet-tool.py generate
else
python /home/joinmarket/joinmarket-clientserver/scripts/wallet-tool.py generate
fi
echo
2020-06-21 01:03:29 +01:00
echo "Press ENTER to return to the menu"
read key
;;
HISTORY)
activateJMvenv
if [ "$(pip list | grep -c scipy)" -eq 0 ];then
echo "# Installing optional dependencies"
pip install scipy
fi
2020-06-22 15:15:28 +01:00
# wallet
chooseWallet
2021-01-04 01:49:33 +00:00
/home/joinmarket/start.script.sh wallet-tool $(cat $wallet) "history -v 4"
echo
2020-06-21 01:03:29 +01:00
echo "Press ENTER to return to the menu"
read key
;;
IMPORT)
/home/joinmarket/info.importwallet.sh
echo "Returning to the menu..."
sleep 1
2020-06-21 01:03:29 +01:00
/home/joinmarket/menu.sh
;;
RECOVER)
2020-06-22 20:51:26 +01:00
clear
echo
2020-06-21 01:03:29 +01:00
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
if [ "${RPCoverTor}" = "on" ];then
2020-06-21 01:03:29 +01:00
torify python /home/joinmarket/joinmarket-clientserver/scripts/wallet-tool.py recover
else
python /home/joinmarket/joinmarket-clientserver/scripts/wallet-tool.py recover
fi
echo ""
2020-06-21 01:03:29 +01:00
echo "Press ENTER to return to the menu"
read key
;;
UNLOCK)
echo "Removing the wallet lockfiles with the command:"
echo "rm ~/.joinmarket/wallets/.*.lock"
2020-08-19 08:42:12 +01:00
rm ~/.joinmarket/wallets/.*.lock
# for old version <v0.6.3
rm ~/.joinmarket/wallets/*.lock 2>/dev/null
echo ""
echo "Press ENTER to return to the menu"
read key
;;
RESCAN)
echo
echo "# Input the blockheight to scan from (first SegWit block: 477120):"
read blockheight
customRPC "# Rescan wallet in bitcoind" "rescanblockchain" "$blockheight"
echo
echo "# Monitor the progress in the logs of the connected bitcoind"
echo
2021-03-02 21:22:19 +00:00
showBitcoinLogs
echo "Press ENTER to return to the menu"
read key
;;
2021-03-02 15:45:00 +00:00
XPUBS)
# wallet
chooseWallet
2021-03-02 21:22:19 +00:00
clear
echo
echo "The 5 master public keys correspond to the 5 mixdepths (accounts) of the JoinMarket wallet."
echo
/home/joinmarket/start.script.sh wallet-tool "$(cat $wallet)"|grep mixdepth|sed -n '1~2p'|awk '{print $3}'
2021-03-02 15:45:00 +00:00
echo
echo "Import the master public keys to Specter Desktop or Electrum to create watch only wallets."
echo
echo "Press ENTER to return to the menu..."
read key
/home/joinmarket/menu.sh
2021-03-02 21:22:19 +00:00
;;
PSBT)
signPSBT
;;
2020-06-15 15:35:18 +01:00
esac