From d7961429ec81ced63aabcec4bc3e2baa2b389949 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 24 Jul 2024 13:28:01 +0300 Subject: [PATCH] Fix tax report if bfx-api pub-trades endpoint does not return array --- workers/loc.api/sync/transaction.tax.report/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workers/loc.api/sync/transaction.tax.report/index.js b/workers/loc.api/sync/transaction.tax.report/index.js index 0c5435d6..ea4852bb 100644 --- a/workers/loc.api/sync/transaction.tax.report/index.js +++ b/workers/loc.api/sync/transaction.tax.report/index.js @@ -458,15 +458,19 @@ class TransactionTaxReport { interrupter }) + const pubTrades = Array.isArray(res) + ? res + : [] + if (isTestEnv) { /* * Need to reverse pub-trades array for test env * as mocked test server return data in desc order */ - return res.reverse() + return pubTrades.reverse() } - return res + return pubTrades } async #updateExactUsdValueInColls (trxs) {