2020-06-13 19:25:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
script="$1"
|
|
|
|
|
if [ ${#script} -eq 0 ]; then
|
2020-06-15 15:34:43 +01:00
|
|
|
echo "must specify a script to run"
|
2020-06-16 13:12:56 +01:00
|
|
|
exit 1
|
2020-06-13 19:25:26 +01:00
|
|
|
fi
|
|
|
|
|
|
2020-06-16 14:29:39 +01:00
|
|
|
wallet="$2"
|
2020-06-16 13:12:56 +01:00
|
|
|
if [ ${#wallet} -eq 0 ] || [ ${wallet} == "" ]; then
|
|
|
|
|
# wallet
|
2020-06-17 11:05:46 +01:00
|
|
|
source menu.functions.sh
|
2020-06-16 13:12:56 +01:00
|
|
|
tempwallet=$(tempfile 2>/dev/null)
|
|
|
|
|
dialog --backtitle "Choose a wallet" \
|
|
|
|
|
--title "Choose a wallet by typing the full name of the file" \
|
|
|
|
|
--fselect "/home/joinmarket/.joinmarket/wallets/" 10 60 2> $tempwallet
|
2020-06-17 11:05:46 +01:00
|
|
|
openMenuIfCancelled $?
|
2020-06-16 13:12:56 +01:00
|
|
|
wallet=$(cat $tempwallet)
|
2020-06-15 15:34:43 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
option="$3"
|
|
|
|
|
if [ ${#option} -eq 0 ] || [ ${option} == nooption ]; then
|
2020-06-13 19:25:26 +01:00
|
|
|
option=""
|
|
|
|
|
fi
|
|
|
|
|
|
2020-06-15 15:34:43 +01:00
|
|
|
mixdepth="$4"
|
|
|
|
|
if [ ${#mixdepth} -eq 0 ]; then
|
|
|
|
|
mixdepth=""
|
|
|
|
|
else
|
|
|
|
|
mixdepth="-m$4"
|
|
|
|
|
fi
|
2020-06-13 19:25:26 +01:00
|
|
|
|
2020-06-15 15:34:43 +01:00
|
|
|
makercount="$5"
|
|
|
|
|
if [ ${#makercount} -eq 0 ]; then
|
|
|
|
|
makercount=""
|
|
|
|
|
else
|
|
|
|
|
makercount="-N$5"
|
|
|
|
|
fi
|
2020-06-13 19:25:26 +01:00
|
|
|
|
2020-06-15 15:34:43 +01:00
|
|
|
amount="$6"
|
|
|
|
|
if [ ${#amount} -eq 0 ]; then
|
|
|
|
|
amount=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
address="$7"
|
|
|
|
|
if [ ${#address} -eq 0 ]; then
|
|
|
|
|
address=""
|
|
|
|
|
fi
|
|
|
|
|
|
2020-06-17 14:52:34 +01:00
|
|
|
source /home/joinmarket/joinin.conf
|
2020-06-16 13:12:56 +01:00
|
|
|
if [ ${RPCoverTor} == on ];then
|
2020-06-15 15:34:43 +01:00
|
|
|
tor="torify"
|
|
|
|
|
else
|
|
|
|
|
tor=""
|
|
|
|
|
fi
|
2020-06-13 19:25:26 +01:00
|
|
|
|
|
|
|
|
# get password
|
|
|
|
|
data=$(tempfile 2>/dev/null)
|
|
|
|
|
|
|
|
|
|
# trap it
|
|
|
|
|
trap "rm -f $data" 0 1 2 5 15
|
|
|
|
|
|
|
|
|
|
dialog --backtitle "Decrypting Wallet" \
|
|
|
|
|
--insecure \
|
|
|
|
|
--passwordbox "Type or paste the wallet decryption password" 8 52 2> $data
|
|
|
|
|
|
|
|
|
|
# make decison
|
|
|
|
|
pressed=$?
|
|
|
|
|
case $pressed in
|
|
|
|
|
0)
|
2020-06-17 14:52:34 +01:00
|
|
|
if [ ${RPCoverTor} == on ];then
|
|
|
|
|
echo "running the command:
|
2020-06-15 15:34:43 +01:00
|
|
|
$tor python ~/joinmarket-clientserver/scripts/$script.py \
|
|
|
|
|
$makercount $mixdepth $wallet $option $amount $address"
|
2020-06-17 14:52:34 +01:00
|
|
|
else
|
|
|
|
|
echo "running the command:
|
|
|
|
|
python ~/joinmarket-clientserver/scripts/$script.py \
|
|
|
|
|
$makercount $mixdepth $wallet $option $amount $address"
|
|
|
|
|
fi
|
2020-06-15 15:34:43 +01:00
|
|
|
echo ""
|
2020-06-17 14:52:34 +01:00
|
|
|
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate
|
2020-06-15 15:34:43 +01:00
|
|
|
cat $data | $tor \
|
|
|
|
|
python ~/joinmarket-clientserver/scripts/$script.py \
|
|
|
|
|
$makercount $mixdepth $wallet $option $amount $address --wallet-password-stdin
|
|
|
|
|
shred $data
|
|
|
|
|
;;
|
2020-06-13 19:25:26 +01:00
|
|
|
1)
|
|
|
|
|
shred $data
|
|
|
|
|
rm -f .pw
|
|
|
|
|
echo "Cancelled"
|
2020-06-15 15:34:43 +01:00
|
|
|
exit 1
|
|
|
|
|
;;
|
2020-06-13 19:25:26 +01:00
|
|
|
255)
|
|
|
|
|
shred $data
|
|
|
|
|
rm -f .pw
|
|
|
|
|
[ -s $data ] && cat $data || echo "ESC pressed."
|
2020-06-15 15:34:43 +01:00
|
|
|
exit 1
|
|
|
|
|
;;
|
2020-06-13 19:25:26 +01:00
|
|
|
esac
|