@@ -18,14 +18,15 @@ usage () {
1818 echo " 3 for FEE_REWARD"
1919 echo " 4 for INCOMING_TRADE"
2020 echo " 5 for OUTGOING_TRADE"
21+ echo " -b basic output (fewer fields)"
2122 echo " -v verbose output"
2223 echo " -h help"
2324 echo " "
2425 echo " Example:"
2526 echo " bash getxchtx.sh -y 2021 -v"
2627 echo " "
2728 echo " Example for saving to file:"
28- echo " bash getxchtx.sh -y 2021 > tx_list.csv"
29+ echo " bash getxchtx.sh -y 2021 >tx_list.csv"
2930 echo " "
3031}
3132
@@ -52,6 +53,7 @@ mojo2xch () {
5253
5354year=" all"
5455verbose=" false"
56+ basic=" false"
5557wallet_id=1
5658trx_start=0
5759trx_end=999999
7375 -t) desired_type=$2 && shift ;;
7476 -min) trx_min=$2 && shift ;;
7577 -max) trx_max=$2 && shift ;;
78+ -b) basic=" true" ;;
7679 -v) verbose=" true" ;;
7780 -h) usage && exit 1 ;;
7881 --) shift && break ;;
@@ -90,7 +93,7 @@ curl -s -X POST --insecure \
9093 -H " Content-Type: application/json" \
9194 " https://localhost:9256/get_transactions" \
9295 -d $query_parameters \
93- | jq > alltxs.json
96+ | jq . > alltxs.json
9497
9598# Write out a fileheader & header row
9699if [ " $verbose " == " true" ]; then
@@ -184,7 +187,11 @@ jq -c '.transactions[]' alltxs.json | while read trx; do
184187 if [ " $verbose " == " true" ]; then
185188 row=" $tx_name ,$tx_datetime ,$tx_typedesc ,$tx_amount ,$current_price ,$tx_additions ,$tx_confirmed ,$tx_confirmed_at_height ,$tx_fee_amount ,$tx_memos ,$tx_removals ,$tx_sent ,$tx_sent_to ,$tx_spend_bundle ,$tx_to_address ,$tx_to_puzzle_hash ,$tx_trade_id ,$tx_wallet_id "
186189 else
187- row=" $tx_name ,$tx_datetime ,$tx_typedesc ,$tx_amount ,$current_price "
190+ if [ " $basic " == " true" ]; then
191+ row=" $tx_datetime ,$tx_typedesc ,$tx_amount "
192+ else
193+ row=" $tx_name ,$tx_datetime ,$tx_typedesc ,$tx_amount ,$current_price "
194+ fi
188195 fi
189196 echo " $row "
190197
@@ -221,3 +228,10 @@ done
221228# - Rewrite so filters are not in a big nested if statement. Use continue to jump to next iteration instead.
222229# New features:
223230# - Add a command option for filtering based on transaction amount.
231+ #
232+ # v0.3.2 - Changes
233+ # - Added filter to jq when building the all transactions file to keep older versions of jq from
234+ # having issues.
235+ # New features:
236+ # - Add a command option called 'basic' for displaying even fewer fields in the result.
237+
0 commit comments