hledger-flow: gemini: allow optional on-chain transfers

Fixes "does not exist as a named header in the given CSV data." when
on-chain transfer does not (yet) exist for given year.
This commit is contained in:
2024-05-29 19:22:15 -07:00
parent cc0cbd06b5
commit e6ab8b5ddf

View File

@@ -50,11 +50,15 @@ function parse_transfers()
if lib_preprocess::test_header "info_feeCurrency"; then
_header="info_eid,info_timestampms,info_type,info_currency,info_feeCurrency,info_amount,info_feeAmount,info_destination,info_txHash"
# Off-chain withdrawal
_header="info_eid,info_timestampms,info_type,info_currency,info_feeCurrency,info_amount,info_feeAmount"
# On-chain
lib_preprocess::test_header "info_destination" && _header+=",info_destination"
lib_preprocess::test_header "info_txHash" && _header+=",info_txHash"
# Off-chain (withdrawal)
lib_preprocess::test_header "info_method" && _header+=",info_method"
# NOTE: this hack in a sort because docker-finance's fetch (or their server's) pagination. See fetch implementation.
xsv select "$_header" "$global_in_path" \
| gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -M -v PREC=100 \
'{