Skip to content

Commit

Permalink
send: add txfee option for every transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
openoms committed Sep 9, 2020
1 parent 43eeb1d commit 06c5f71
Showing 1 changed file with 43 additions and 21 deletions.
64 changes: 43 additions & 21 deletions scripts/menu.send.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ source /home/joinmarket/menu.functions.sh
chooseWallet

# mixdepth
mixdepth=$(tempfile 2>/dev/null)
mixdepth=$(mktemp 2>/dev/null)
dialog --backtitle "Choose a mixdepth to send from" \
--title "Choose a mixdepth to send from" \
--inputbox "
Enter a number between 0 to 4 to choose the mixdepth" 9 60 2> $mixdepth
Enter a number between 0 to 4 to choose the mixdepth" 9 60 2> "$mixdepth"
openMenuIfCancelled $?

# makercount
makercount=$(tempfile 2>/dev/null)
makercount=$(mktemp 2>/dev/null)
dialog --backtitle "Choose the makercount" \
--title "Choose the makercount" \
--inputbox "
Enter the number of makers to coinjoin with (min 4)
Leave empty for the default 5-7 (randomized)
Enter 0 to send without a coinjoin." 11 60 2> $makercount
#openMenuIfCancelled $?
varMakercount=$(cat $makercount)
Enter 0 to send without a coinjoin." 11 60 2> "$makercount"
openMenuIfCancelled $?
varMakercount=$(cat "$makercount")
if [ ${#varMakercount} -eq 0 ]; then
makercountMessage="coinjoined with 5-7 (randomized) makers"
makercountOption=""
elif [ $varMakercount = "0" ]; then
elif [ "$varMakercount" = "0" ]; then
makercountMessage="no coinjoin"
makercountOption="-N 0"
else
Expand All @@ -36,23 +36,40 @@ else
fi

# amount
amount=$(tempfile 2>/dev/null)
amount=$(mktemp 2>/dev/null)
dialog --backtitle "Choose the amount" \
--title "Choose the amount" \
--inputbox "
Enter the amount to send in satoshis
Use 0 to sweep the mixdepth without a change output" 10 60 2> $amount
Use 0 to sweep the mixdepth without a change output" 10 60 2> "$amount"
openMenuIfCancelled $?

# txfee
txfee=$(mktemp 2>/dev/null)
dialog --backtitle "Choose the miner fee" \
--title "Choose the miner fee" \
--inputbox "
Enter the miner fee to be used for the transaction in sat/byte
Leave empty to use the default fee (set in the joinmarket.cfg)" 10 67 2> "$txfee"
openMenuIfCancelled $?
varTxfee=$(cat "$txfee")
if [ ${#varTxfee} -eq 0 ]; then
txfeeMessage="default (set in the joinmarket.cfg)"
txfeeOption=""
else
txfeeMessage="$varTxfee sat/byte"
txfeeOption="--txfee=$((varTxfee * 1000))"
fi

# address
address=$(tempfile 2>/dev/null)
address=$(mktemp 2>/dev/null)
dialog --backtitle "Choose the address" \
--title "Choose the address" \
--inputbox "
Paste the destination address" 9 60 2> $address
Paste the destination address" 9 60 2> "$address"
openMenuIfCancelled $?

if [ ${RPCoverTor} = "on" ]; then
if [ "${RPCoverTor}" = "on" ]; then
tor="torify"
else
tor=""
Expand All @@ -62,16 +79,18 @@ fi
dialog --backtitle "Confirm the details" \
--title "Confirm the details" \
--yesno "
Send: $(cat $amount) sats
Send: $(cat "$amount") sats
From the wallet:
$(echo $(cat $wallet) | sed "s#$walletPath##g")
mixdepth: $(cat $mixdepth)
$(sed "s#$walletPath##g" < "$wallet" )
mixdepth: $(cat "$mixdepth")
to the address:
$(cat $address)
$(cat "$address")
$makercountMessage.
$makercountMessage." 16 60
Miner fee: $txfeeMessage" 18 60

# make decison
pressed=$?
Expand All @@ -81,13 +100,16 @@ case $pressed in
# display
echo "Running the command:
$tor python sendpayment.py \
-m $(cat $mixdepth) $makercountOption \
$(echo $(cat $wallet) | sed "s#$walletPath##g") $(cat $amount) $(cat $address)
-m $(cat "$mixdepth") $makercountOption $(sed "s#$walletPath##g" < "$wallet" ) \
$(cat "$amount") $(cat "$address") $txfeeOption
"
# run
$tor python ~/joinmarket-clientserver/scripts/sendpayment.py \
-m $(cat $mixdepth) $makercountOption $(cat $wallet) \
$(cat $amount) $(cat $address)
-m "$(cat "$mixdepth")" "$makercountOption" "$(cat "$wallet")" \
"$(cat "$amount")" "$(cat "$address")" $txfeeOption
echo ""
echo "Press ENTER to return to the menu..."
read key
;;
1)
echo "Cancelled"
Expand Down

0 comments on commit 06c5f71

Please sign in to comment.