Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
👌 Apply review recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersubudhi committed Feb 8, 2024
1 parent d02e104 commit 9032ed2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 0 additions & 3 deletions services/export/shared/helpers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ const normalizeTransactionAmount = (address, tx, currentChainID) => {
return (sign * amount).toString();
}

const isReclaim = tx.moduleCommand === `${MODULE.LEGACY}:${COMMAND.RECLAIM_LSK}`;
const isTokenTransfer = tx.moduleCommand === `${MODULE.TOKEN}:${COMMAND.TRANSFER}`;

const isSender = address === tx.sender.address;
const isRecipient = isTokenTransfer && address === tx.params.recipientAddress;
const isSelfTransfer = isTokenTransfer && tx.sender.address === tx.params.recipientAddress;
const { isSelfTokenTransferCredit, isIncomingCrossChainTransferTransaction } = tx;

const sign =
(isReclaim && isSender) ||
(isTokenTransfer && isRecipient && !isSelfTransfer) ||
(isTokenTransfer && isRecipient && isSelfTransfer && isSelfTokenTransferCredit) ||
isIncomingCrossChainTransferTransaction
Expand Down
6 changes: 4 additions & 2 deletions services/export/shared/transactionsExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const {
} = require('./helpers/constants');
const {
resolveChainIDs,
getBlocks,
getTransactions,
getEvents,
getAllBlocksInAsc,
getAllTransactionsInAsc,
Expand Down Expand Up @@ -565,7 +567,7 @@ const getEntriesByChronology = async (params, sortedBlocks, sortedTransactions,
if (txInList) return txInList;

// because transaction may not be available for validator custodial reward reduction in the sorted list
const [txFromIndexer] = (await requestIndexer('transactions', { id: transactionID })).data;
const [txFromIndexer] = (await getTransactions({ id: transactionID })).data;
return txFromIndexer;
})();
const block = await (async () => {
Expand All @@ -574,7 +576,7 @@ const getEntriesByChronology = async (params, sortedBlocks, sortedTransactions,
if (blockInList) return blockInList;

// because block may not be available for validator custodial reward reduction in the sorted list
const [blockFromIndexer] = (await requestIndexer('blocks', { id: blockID })).data;
const [blockFromIndexer] = (await getBlocks({ id: blockID })).data;
return blockFromIndexer;
})();

Expand Down

0 comments on commit 9032ed2

Please sign in to comment.