Skip to content

Commit 06c5f71

Browse files
committed
send: add txfee option for every transaction
1 parent 43eeb1d commit 06c5f71

1 file changed

Lines changed: 43 additions & 21 deletions

File tree

scripts/menu.send.sh

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ source /home/joinmarket/menu.functions.sh
77
chooseWallet
88

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

1717
# makercount
18-
makercount=$(tempfile 2>/dev/null)
18+
makercount=$(mktemp 2>/dev/null)
1919
dialog --backtitle "Choose the makercount" \
2020
--title "Choose the makercount" \
2121
--inputbox "
2222
Enter the number of makers to coinjoin with (min 4)
2323
Leave empty for the default 5-7 (randomized)
24-
Enter 0 to send without a coinjoin." 11 60 2> $makercount
25-
#openMenuIfCancelled $?
26-
varMakercount=$(cat $makercount)
24+
Enter 0 to send without a coinjoin." 11 60 2> "$makercount"
25+
openMenuIfCancelled $?
26+
varMakercount=$(cat "$makercount")
2727
if [ ${#varMakercount} -eq 0 ]; then
2828
makercountMessage="coinjoined with 5-7 (randomized) makers"
2929
makercountOption=""
30-
elif [ $varMakercount = "0" ]; then
30+
elif [ "$varMakercount" = "0" ]; then
3131
makercountMessage="no coinjoin"
3232
makercountOption="-N 0"
3333
else
@@ -36,23 +36,40 @@ else
3636
fi
3737

3838
# amount
39-
amount=$(tempfile 2>/dev/null)
39+
amount=$(mktemp 2>/dev/null)
4040
dialog --backtitle "Choose the amount" \
4141
--title "Choose the amount" \
4242
--inputbox "
4343
Enter the amount to send in satoshis
44-
Use 0 to sweep the mixdepth without a change output" 10 60 2> $amount
44+
Use 0 to sweep the mixdepth without a change output" 10 60 2> "$amount"
4545
openMenuIfCancelled $?
4646

47+
# txfee
48+
txfee=$(mktemp 2>/dev/null)
49+
dialog --backtitle "Choose the miner fee" \
50+
--title "Choose the miner fee" \
51+
--inputbox "
52+
Enter the miner fee to be used for the transaction in sat/byte
53+
Leave empty to use the default fee (set in the joinmarket.cfg)" 10 67 2> "$txfee"
54+
openMenuIfCancelled $?
55+
varTxfee=$(cat "$txfee")
56+
if [ ${#varTxfee} -eq 0 ]; then
57+
txfeeMessage="default (set in the joinmarket.cfg)"
58+
txfeeOption=""
59+
else
60+
txfeeMessage="$varTxfee sat/byte"
61+
txfeeOption="--txfee=$((varTxfee * 1000))"
62+
fi
63+
4764
# address
48-
address=$(tempfile 2>/dev/null)
65+
address=$(mktemp 2>/dev/null)
4966
dialog --backtitle "Choose the address" \
5067
--title "Choose the address" \
5168
--inputbox "
52-
Paste the destination address" 9 60 2> $address
69+
Paste the destination address" 9 60 2> "$address"
5370
openMenuIfCancelled $?
5471

55-
if [ ${RPCoverTor} = "on" ]; then
72+
if [ "${RPCoverTor}" = "on" ]; then
5673
tor="torify"
5774
else
5875
tor=""
@@ -62,16 +79,18 @@ fi
6279
dialog --backtitle "Confirm the details" \
6380
--title "Confirm the details" \
6481
--yesno "
65-
Send: $(cat $amount) sats
82+
Send: $(cat "$amount") sats
6683
6784
From the wallet:
68-
$(echo $(cat $wallet) | sed "s#$walletPath##g")
69-
mixdepth: $(cat $mixdepth)
85+
$(sed "s#$walletPath##g" < "$wallet" )
86+
mixdepth: $(cat "$mixdepth")
7087
7188
to the address:
72-
$(cat $address)
89+
$(cat "$address")
90+
91+
$makercountMessage.
7392
74-
$makercountMessage." 16 60
93+
Miner fee: $txfeeMessage" 18 60
7594

7695
# make decison
7796
pressed=$?
@@ -81,13 +100,16 @@ case $pressed in
81100
# display
82101
echo "Running the command:
83102
$tor python sendpayment.py \
84-
-m $(cat $mixdepth) $makercountOption \
85-
$(echo $(cat $wallet) | sed "s#$walletPath##g") $(cat $amount) $(cat $address)
103+
-m $(cat "$mixdepth") $makercountOption $(sed "s#$walletPath##g" < "$wallet" ) \
104+
$(cat "$amount") $(cat "$address") $txfeeOption
86105
"
87106
# run
88107
$tor python ~/joinmarket-clientserver/scripts/sendpayment.py \
89-
-m $(cat $mixdepth) $makercountOption $(cat $wallet) \
90-
$(cat $amount) $(cat $address)
108+
-m "$(cat "$mixdepth")" "$makercountOption" "$(cat "$wallet")" \
109+
"$(cat "$amount")" "$(cat "$address")" $txfeeOption
110+
echo ""
111+
echo "Press ENTER to return to the menu..."
112+
read key
91113
;;
92114
1)
93115
echo "Cancelled"

0 commit comments

Comments
 (0)